Untitled
it("test", async () => { const fakeDate = new Date("2023-04-22"); console.log("Normal: ", new Date().getTime()); const spy = jest.spyOn(global, "Date").mockImplementation(() => fakeDate); console.log("Mocked: ", new Date().getTime()); });
Leave a Comment