Skip to content
Snippets Groups Projects
Commit c5fa30ff authored by Jahred Hope's avatar Jahred Hope Committed by Rhys Arkins
Browse files

test: use local times for tests (#1354)

This change allows unit tests that don't set a timezone to refer to the local time.

Closes #1353
parent ac3d2459
No related branches found
No related tags found
No related merge requests found
......@@ -78,7 +78,7 @@ describe('workers/branch/schedule', () => {
describe('isScheduledNow(config)', () => {
let config;
beforeEach(() => {
mockDate.set(1498812608678); // 2017-06-30 10:50am
mockDate.set('2017-06-30T10:50:00.000'); // Locally 2017-06-30 10:50am
jest.resetAllMocks();
config = {};
});
......@@ -114,6 +114,7 @@ describe('workers/branch/schedule', () => {
it('supports timezone', () => {
config.schedule = ['after 4:00pm'];
config.timezone = 'Asia/Singapore';
mockDate.set('2017-06-30T10:50:00.000Z'); // Globally 2017-06-30 10:50am
const res = schedule.isScheduledNow(config);
expect(res).toBe(true);
});
......@@ -159,7 +160,7 @@ describe('workers/branch/schedule', () => {
});
it('approves first day of the month', () => {
config.schedule = ['before 11am on the first day of the month'];
mockDate.set(1506835566000); // Sunday, 1 October 2017 05:26:06
mockDate.set('2017-10-01T05:26:06.000'); // Locally Sunday, 1 October 2017 05:26:06
const res = schedule.isScheduledNow(config);
expect(res).toBe(true);
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment