-
-
Save simianarmy/71897bf02f8994338e9b695b396dfc76 to your computer and use it in GitHub Desktop.
Partial module mocks with dynamic mocks
This file contains 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
import {random} from 'lodash' | |
jest.mock('lodash', () => { | |
return { | |
...jest.requireActual('lodash'), | |
random: jest.fn(), | |
} | |
}); | |
test('get 5', () => { | |
random.mockImplementation(() => 5); | |
// test code | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment