// Unit testing react-router
// pay attention to write it at your test file top level
const mockedUsedNavigate = jest.fn();
jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom') as any,
useNavigate: () => mockedUsedNavigate,
}));
// your describe/it/test blocks go down there
Last active
September 15, 2021 14:43
-
-
Save exaucae/c2897f11596a94061c1059678615ba81 to your computer and use it in GitHub Desktop.
React unit testing tricks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment