diff --git a/plugins/user-settings/src/components/SettingsPage.test.tsx b/plugins/user-settings/src/components/SettingsPage.test.tsx
index 865d0918e7..01810bcc8e 100644
--- a/plugins/user-settings/src/components/SettingsPage.test.tsx
+++ b/plugins/user-settings/src/components/SettingsPage.test.tsx
@@ -27,6 +27,10 @@ jest.mock('react-router', () => ({
import { useOutlet } from 'react-router';
describe('', () => {
+ beforeEach(() => {
+ (useOutlet as jest.Mock).mockReset();
+ });
+
it('should render the settings page with 3 tabs', async () => {
const { container } = await renderWithEffects(
wrapInTestApp(),
@@ -38,13 +42,11 @@ describe('', () => {
it('should render the settings page with 4 tabs when extra tabs are provided', async () => {
const advancedTabRoute = (
- <>
-
- Advanced settings
-
- >
+
+ Advanced settings
+
);
- (useOutlet as jest.Mock).mockReturnValueOnce(advancedTabRoute);
+ (useOutlet as jest.Mock).mockReturnValue(advancedTabRoute);
const { container } = await renderWithEffects(
wrapInTestApp(),
);
@@ -53,25 +55,4 @@ describe('', () => {
expect(tabs).toHaveLength(4);
expect(tabs[3].textContent).toEqual('Advanced');
});
-
- it('should throw error if non compliant route is passed to settings routes', async () => {
- const advancedTabRoute = (
- <>
-
- Advanced settings
-
-
Non compliant element
- >
- );
- (useOutlet as jest.Mock).mockReturnValueOnce(advancedTabRoute);
- let error: Error;
- try {
- await renderWithEffects(wrapInTestApp());
- } catch (err) {
- error = err;
- }
- expect(error!.message).toEqual(
- expect.stringContaining('Invalid element passed'),
- );
- });
});