fix SharedPreferences tests

This commit is contained in:
Ashley Harrison
2025-12-08 13:56:10 +00:00
parent e861318c2d
commit 03a044a9a0
@@ -1,3 +1,4 @@
import { act } from '@testing-library/react';
import { comboboxTestSetup } from 'test/helpers/comboboxTestSetup';
import { getSelectParent, selectOptionInTest } from 'test/helpers/selectOptionInTest';
import { render, screen, userEvent, waitFor, within } from 'test/test-utils';
@@ -29,7 +30,9 @@ const selectComboboxOptionInTest = async (input: HTMLElement, optionOrOptions: s
};
const setup = async () => {
const view = render(<SharedPreferences resourceUri="user" preferenceType="user" />);
// TODO investigate why we need act
// see https://github.com/testing-library/react-testing-library/issues/1375
const view = await act(() => render(<SharedPreferences resourceUri="user" preferenceType="user" />));
const themeSelect = await screen.findByRole('combobox', { name: 'Interface theme' });
await waitFor(() => expect(themeSelect).not.toBeDisabled());
return view;