Skip to content

Commit

Permalink
CCM-7650: review
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-r-bjss committed Nov 15, 2024
1 parent a8474cc commit b6310c1
Show file tree
Hide file tree
Showing 3 changed files with 123 additions and 117 deletions.
210 changes: 105 additions & 105 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 17 additions & 11 deletions src/__tests__/components/Redirect.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,23 @@ jest.mock('next/navigation', () => ({
const redirectMock = jest.mocked(redirect);
const useSearchParamsMock = jest.mocked(useSearchParams);

test.each(['/redirect-path', 'redirect-path'])('Redirect - URL provided %p', (redirect) => {
const mockSearchParams = new ReadonlyURLSearchParams({
redirect,
});

useSearchParamsMock.mockReturnValue(mockSearchParams);

render(<Redirect />);

expect(redirectMock).toHaveBeenCalledWith(`/redirect/redirect-path`, 'push');
});
test.each(['/redirect-path', 'redirect-path'])(
'Redirect - URL provided %p',
(testPath) => {
const mockSearchParams = new ReadonlyURLSearchParams({
testPath,
});

useSearchParamsMock.mockReturnValue(mockSearchParams);

render(<Redirect />);

expect(redirectMock).toHaveBeenCalledWith(
`/redirect/redirect-path`,
'push'
);
}
);

test('Redirect - URL not provided', () => {
const mockSearchParams = new ReadonlyURLSearchParams({});
Expand Down
2 changes: 1 addition & 1 deletion src/components/molecules/Redirect/Redirect.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';

import { useSearchParams, redirect, RedirectType } from 'next/navigation';
import path from 'path';
import path from 'node:path';

export const Redirect = () => {
const searchParams = useSearchParams();
Expand Down

0 comments on commit b6310c1

Please sign in to comment.