1 import * as reactRouterDomModule from 'react-router-dom';
3 // A simple workaround for jest issue not solved yet
4 // https://stackoverflow.com/questions/67872622/jest-spyon-not-working-on-index-file-cannot-redefine-property
5 jest.mock('react-router-dom', () => {
8 ...jest.requireActual('react-router-dom'),
12 export const mockUseLocation = (value?: Partial<ReturnType<typeof reactRouterDomModule.useLocation>>) => {
13 const mockedUseLocation = jest.spyOn(reactRouterDomModule, 'useLocation');
15 mockedUseLocation.mockReturnValue({
23 return mockedUseLocation;