"fix" VersionsSettings tests

This commit is contained in:
Ashley Harrison
2025-12-12 11:24:00 +00:00
parent b380ce2bfd
commit 720f038981
@@ -1,4 +1,4 @@
import { screen, waitFor, within } from '@testing-library/react';
import { act, fireEvent, screen, waitFor, within } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { render } from 'test/test-utils';
@@ -154,7 +154,9 @@ describe('VersionSettings', () => {
expect(within(screen.getAllByRole('rowgroup')[1]).getAllByRole('row').length).toBe(VERSIONS_FETCH_LIMIT);
const showMoreButton = screen.getByRole('button', { name: /show more versions/i });
await user.click(showMoreButton);
// TODO investigate why we need act/fireEvent
// see https://github.com/testing-library/react-testing-library/issues/1375
act(() => fireEvent.click(showMoreButton));
expect(historySrv.getHistoryList).toBeCalledTimes(2);
expect(screen.getByText(/Fetching more entries/i)).toBeInTheDocument();