Skip to content

Commit

Permalink
Fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
OsamaAbdellateef committed May 10, 2024
1 parent c72bf27 commit 9b83a44
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions docs/ui/ThemeSwitch.test.tsx
Expand Up @@ -9,11 +9,17 @@ const themes = {
coreTheme,
};

const useRouter = require('next/navigation').useRouter;

jest.mock('next/navigation', () => ({
useRouter: jest.fn(),
useSearchParams: jest.fn(),
}));

beforeEach(() => {
useRouter.mockReturnValue({ replace: jest.fn() });
});

afterEach(() => {
jest.clearAllMocks();
jest.resetAllMocks();
Expand All @@ -32,8 +38,7 @@ test('returns the theme', () => {
});

test('switches the theme', async () => {
const useRouter = require('next/navigation').useRouter;
useRouter.mockReturnValue({ replace: jest.fn() });
// useRouter.mockReturnValue({ replace: jest.fn() });

const { result } = renderHook(() => useThemeSwitch(), { wrapper });

Expand Down

0 comments on commit 9b83a44

Please sign in to comment.