test: Fixes act errors in LastUpdated test (#21415)

This commit is contained in:
Michael S. Molina
2022-09-12 09:21:09 -03:00
committed by GitHub
parent 99628d3e84
commit c16a6dd2f4

View File

@@ -20,6 +20,7 @@
import React from 'react';
import { ReactWrapper } from 'enzyme';
import { styledMount as mount } from 'spec/helpers/theming';
import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint';
import LastUpdated from '.';
describe('LastUpdated', () => {
@@ -31,9 +32,10 @@ describe('LastUpdated', () => {
expect(/^Last Updated .+$/.test(wrapper.text())).toBe(true);
});
it('renders a refresh action', () => {
it('renders a refresh action', async () => {
const mockAction = jest.fn();
wrapper = mount(<LastUpdated updatedAt={updatedAt} update={mockAction} />);
await waitForComponentToPaint(wrapper);
const props = wrapper.find('[aria-label="refresh"]').first().props();
if (props.onClick) {
props.onClick({} as React.MouseEvent);