Closed masakudamatsu closed 4 years ago
We can mock the history.push() function as follows (source: https://stackoverflow.com/a/59451956/11847654)
history.push()
const mockHistoryPush = jest.fn(); jest.mock('react-router', () => ({ ...jest.requireActual('react-router'), useHistory: () => ({ push: mockHistoryPush, }), }));
We can mock the
history.push()
function as follows (source: https://stackoverflow.com/a/59451956/11847654)