describe("mock global date", ()=> {
beforeEach(async () => {
global.Date.now = jest.fn(() => new Date("2020-01-01T12:00:00Z").getTime());
});
afterAll(() => {
global.Date.now = RealDate;
});
});
describe("mock date methods", ()=> {
jest
.spyOn(Date.prototype, "toISOString")
.mockReturnValue("2020-01-01T12:00:00Z");
});
jest.spyOn(Storage.prototype, "getItem").mockReturnValue("getItem");