Created
July 24, 2020 00:21
-
-
Save dejanvasic85/c3e85479de3a75211271712595f9b949 to your computer and use it in GitHub Desktop.
Jest Typescript mocking function example
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 * as dateService from './dateService'; | |
const nowMock = dateService.now as jest.MockedFunction<typeof dateService.now>; | |
describe('some service', () => { | |
const mockNow = 'now'; | |
beforeEach(() => { | |
nowMock.mockReturnedValue(mockNow); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment