Created
October 4, 2022 10:10
-
-
Save sidouglas/c8ed66dcf44b747853586ecf170da877 to your computer and use it in GitHub Desktop.
Mock Moment + return Moment that is static
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
jest.mock('moment', () => { | |
const mock = (timeStamp: string = '2022-09-29T00:00:00Z') => | |
jest.requireActual('moment')(timeStamp); | |
return Object.assign(mock, jest.requireActual('moment')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment