Skip to content

Instantly share code, notes, and snippets.

@bengry
Last active May 24, 2021 10:29
Show Gist options
  • Save bengry/b39f4eb6d98f1cc238882892d604dea7 to your computer and use it in GitHub Desktop.
Save bengry/b39f4eb6d98f1cc238882892d604dea7 to your computer and use it in GitHub Desktop.
import { setupMockDate, MockDateSetup } from 'test-utils';
let mockDate: MockDateSetup;
beforeEach(() => {
mockDate = setupMockDate();
});
afterEach(() => {
mockDate.reset();
});
test("...", () => {
mockDate.set({ offset: 600, isoDate: '2019-07-14T07:50:51.386Z' });
new Date() // Sun Jul 14 2019 17:50:51 GMT+1000
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment