From 9dad49eb7171c374a67b5352cb5bd4db79589e6e Mon Sep 17 00:00:00 2001 From: Viktor Vorona Date: Tue, 20 Feb 2024 12:33:24 +0100 Subject: SONAR-21692 Remove act() that are not needed --- .../src/components/input/__tests__/DateRangePicker-test.tsx | 6 ++---- .../src/components/input/__tests__/SearchSelectDropdown-test.tsx | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'server/sonar-web/design-system') diff --git a/server/sonar-web/design-system/src/components/input/__tests__/DateRangePicker-test.tsx b/server/sonar-web/design-system/src/components/input/__tests__/DateRangePicker-test.tsx index 65d0625d6cf..d552d33d231 100644 --- a/server/sonar-web/design-system/src/components/input/__tests__/DateRangePicker-test.tsx +++ b/server/sonar-web/design-system/src/components/input/__tests__/DateRangePicker-test.tsx @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { act, screen } from '@testing-library/react'; +import { screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { formatISO, parseISO } from 'date-fns'; import { byRole } from '../../../../../src/main/js/helpers/testSelector'; @@ -58,9 +58,7 @@ it('behaves correctly', async () => { onChange.mockClear(); - act(() => { - jest.runAllTimers(); - }); + jest.runAllTimers(); const previousButton = nav.byRole('button', { name: 'previous_month_x' }); const nextButton = nav.byRole('button', { name: 'next_month_x' }); diff --git a/server/sonar-web/design-system/src/components/input/__tests__/SearchSelectDropdown-test.tsx b/server/sonar-web/design-system/src/components/input/__tests__/SearchSelectDropdown-test.tsx index 9f24bd11675..0e0c83c33bc 100644 --- a/server/sonar-web/design-system/src/components/input/__tests__/SearchSelectDropdown-test.tsx +++ b/server/sonar-web/design-system/src/components/input/__tests__/SearchSelectDropdown-test.tsx @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { act, screen } from '@testing-library/react'; +import { screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { renderWithContext } from '../../../helpers/testUtils'; import { FCProps } from '../../../types/misc'; @@ -65,9 +65,7 @@ it('should handle key navigation', async () => { expect(screen.queryByText('different')).not.toBeInTheDocument(); await user.keyboard('{Escape}'); expect(await screen.findByText('different')).toBeInTheDocument(); - await act(async () => { - await user.keyboard('{Escape}'); - }); + await user.keyboard('{Escape}'); expect(screen.queryByText('different')).not.toBeInTheDocument(); await user.tab({ shift: true }); await user.keyboard('{ArrowDown}'); -- cgit v1.2.3