jest-mock-new-date
v1.0.5
Published
Just add 'mockDate(mockedDate)' as hook for jest tests scope (describe function) and use 'new Date(mockedDate)' in tests.
Downloads
11
Readme
jest-mock-new-date
npm i --save-dev jest-mock-new-date
How to use:
import { mockDate } from 'jest-mock-new-date'
describe('...', () => {
const mockedDate = '2022-03-22T06:14:10.713Z'
mockDate(mockedDate)
test('...', () => {
new Date(mockedDate)
})
})