Select: use findBy and make these tests async to avoid act() errors (#42134)

pull/42145/head
Ashley Harrison 4 years ago committed by GitHub
parent d2d38c978f
commit 20e1457a78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      public/app/core/components/Select/TeamPicker.test.tsx
  2. 4
      public/app/features/dashboard/components/DashboardSettings/GeneralSettings.test.tsx

@ -13,11 +13,11 @@ jest.mock('@grafana/runtime', () => ({
}));
describe('TeamPicker', () => {
it('renders correctly', () => {
it('renders correctly', async () => {
const props = {
onSelected: () => {},
};
render(<TeamPicker {...props} />);
expect(screen.getByTestId('teamPicker')).toBeInTheDocument();
expect(await screen.findByTestId('teamPicker')).toBeInTheDocument();
});
});

@ -35,11 +35,11 @@ const setupTestContext = (options: Partial<Props>) => {
describe('General Settings', () => {
describe('when component is mounted with timezone', () => {
it('should render correctly', () => {
it('should render correctly', async () => {
setupTestContext({});
screen.getByDisplayValue('test dashboard title');
screen.getByDisplayValue('test dashboard description');
expect(screen.getByTestId(selectors.components.TimeZonePicker.containerV2)).toHaveTextContent(
expect(await screen.findByTestId(selectors.components.TimeZonePicker.containerV2)).toHaveTextContent(
'Coordinated Universal Time'
);
});

Loading…
Cancel
Save