mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Select: use findBy and make these tests async to avoid act() errors (#42134)
This commit is contained in:
parent
d2d38c978f
commit
20e1457a78
@ -13,11 +13,11 @@ jest.mock('@grafana/runtime', () => ({
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
describe('TeamPicker', () => {
|
describe('TeamPicker', () => {
|
||||||
it('renders correctly', () => {
|
it('renders correctly', async () => {
|
||||||
const props = {
|
const props = {
|
||||||
onSelected: () => {},
|
onSelected: () => {},
|
||||||
};
|
};
|
||||||
render(<TeamPicker {...props} />);
|
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('General Settings', () => {
|
||||||
describe('when component is mounted with timezone', () => {
|
describe('when component is mounted with timezone', () => {
|
||||||
it('should render correctly', () => {
|
it('should render correctly', async () => {
|
||||||
setupTestContext({});
|
setupTestContext({});
|
||||||
screen.getByDisplayValue('test dashboard title');
|
screen.getByDisplayValue('test dashboard title');
|
||||||
screen.getByDisplayValue('test dashboard description');
|
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'
|
'Coordinated Universal Time'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user