We can mock the useLocation() by using the following code
jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'),
useLocation: () => ({
pathname: 'localhost:3000/examplePath/123',
}),
}));
We can mock the useLocation() by using the following code
jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'),
useLocation: () => ({
pathname: 'localhost:3000/examplePath/123',
}),
}));