test: Fix await-async-events error

After cleaning up the ESLint plugins a new error for eslint-plugin-testing-library popped up. This PR solves all of the occurences of `Promise returned from async event method `user` must be handled` and removes the `"testing-library/await-async-events": "off"` switch which was temporary put in place.
This commit is contained in:
regexowl 2023-10-20 10:24:22 +02:00 committed by Klara Simickova
parent 2687312f16
commit 7b0b9a8ddc
5 changed files with 108 additions and 106 deletions

View file

@ -42,19 +42,19 @@ describe('Create Share To Regions Modal', () => {
const selectToggle = screen.getByRole('button', { name: /menu toggle/i });
// eslint-disable-next-line testing-library/no-unnecessary-act
user.click(selectToggle);
await user.click(selectToggle);
const usEast2 = await screen.findByRole('option', {
name: /us east \(ohio\) us\-east\-2/i,
});
expect(usEast2).not.toHaveClass('pf-m-disabled');
user.click(usEast2);
await user.click(usEast2);
await waitFor(() => expect(shareButton).toBeEnabled());
const clearAllButton = screen.getByRole('button', {
name: /clear input value/i,
});
user.click(clearAllButton);
await user.click(clearAllButton);
await waitFor(() => expect(shareButton).toBeDisabled());
const invalidAlert = screen.getByText(
@ -71,7 +71,7 @@ describe('Create Share To Regions Modal', () => {
);
const cancelButton = await screen.findByRole('button', { name: /cancel/i });
user.click(cancelButton);
await user.click(cancelButton);
// returns back to the landing page
await waitFor(() =>
@ -87,7 +87,7 @@ describe('Create Share To Regions Modal', () => {
);
const closeButton = await screen.findByRole('button', { name: /close/i });
user.click(closeButton);
await user.click(closeButton);
// returns back to the landing page
await waitFor(() =>
@ -102,7 +102,7 @@ describe('Create Share To Regions Modal', () => {
name: /menu toggle/i,
});
// eslint-disable-next-line testing-library/no-unnecessary-act
user.click(selectToggle);
await user.click(selectToggle);
// parent region disabled
const usEast1 = await screen.findByRole('option', {