Answers for "snapshot keeps failing due to new Date"

0

snapshot keeps failing due to new Date

beforeEach(() => {
    jest.spyOn(Date.prototype, 'getDay').mockReturnValue(2);
    jest.spyOn(Date.prototype, 'toISOString').mockReturnValue('2000-01-01T00:00:00.000Z');
});

afterEach(() => {
    jest.restoreAll()
});
Posted by: Guest on August-05-2021

Browse Popular Code Answers by Language