Skip to content

Instantly share code, notes, and snippets.

@sidouglas
Created October 4, 2022 10:10
Show Gist options
  • Save sidouglas/c8ed66dcf44b747853586ecf170da877 to your computer and use it in GitHub Desktop.
Save sidouglas/c8ed66dcf44b747853586ecf170da877 to your computer and use it in GitHub Desktop.
Mock Moment + return Moment that is static
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