test/ShareImageModal: use act when accessing the UI

Errors were fired upon while testing the ShareImageModal because some
clicks on the UI were not encapsulated in an act block. This is now
patched up.
This commit is contained in:
Thomas Lavocat 2023-08-07 15:05:49 +02:00 committed by Thomas Lavocat
parent 8144aaa76d
commit 2b051823bf

View file

@ -144,13 +144,13 @@ describe('Create Share To Regions Modal', () => {
);
const selectToggle = screen.getByRole('button', { name: /options menu/i });
await user.click(selectToggle);
await act(async () => user.click(selectToggle));
const usEast2 = screen.getByRole('option', {
name: /us-east-2 us east \(ohio\)/i,
});
expect(usEast2).not.toHaveClass('pf-m-disabled');
await user.click(usEast2);
await act(async () => user.click(usEast2));
const mockResponse = {
id: '123e4567-e89b-12d3-a456-426655440000',