Last active
March 29, 2023 13:12
-
-
Save sketchbuch/fde627a2e65f1225d6c61cc659966361 to your computer and use it in GitHub Desktop.
TESTING - Jest mock useHistory hook for a test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Imports go here... no need to import react-router-dom | |
jest.mock('react-router-dom', () => ({ | |
useHistory: () => ({ push: jest.fn() }), | |
})) | |
// describe(), test() etc go here... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment