From 20f4e8735a13d5212faf3278f47469ab906b65b2 Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Sat, 22 May 2021 14:47:35 +0200 Subject: [PATCH] Fixing JobSchedule tests #273 --- test/common/unit/JobScheduleDTO.spec.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/test/common/unit/JobScheduleDTO.spec.ts b/test/common/unit/JobScheduleDTO.spec.ts index 1ff15805..a506c88d 100644 --- a/test/common/unit/JobScheduleDTO.spec.ts +++ b/test/common/unit/JobScheduleDTO.spec.ts @@ -5,7 +5,7 @@ describe('JobScheduleDTO', () => { it('should get date from schedule', async () => { - const refDate = new Date(2019, 7, 18, 5, 10, 10, 0); // its a sunday + const refDate = new Date(Date.UTC(2019, 7, 18, 5, 10, 10, 0)); // its a sunday expect(JobScheduleDTOUtils.getNextRunningDate(refDate, { @@ -24,10 +24,10 @@ describe('JobScheduleDTO', () => { expect(JobScheduleDTOUtils.getNextRunningDate(refDate, { trigger: { type: JobTriggerType.periodic, - atTime: (h * 60 + m) * 60 * 1000, + atTime: (h * 60 + m), periodicity: dayOfWeek } - } as any)).to.be.deep.equal((new Date(2019, 7, nextDay, h, m, 0)), 'for day: ' + dayOfWeek); + } as any)).to.be.deep.equal((new Date(Date.UTC(2019, 7, nextDay, h, m, 0))), 'for day: ' + dayOfWeek); h = 2; m = 5; @@ -35,10 +35,10 @@ describe('JobScheduleDTO', () => { expect(JobScheduleDTOUtils.getNextRunningDate(refDate, { trigger: { type: JobTriggerType.periodic, - atTime: (h * 60 + m) * 60 * 1000, + atTime: (h * 60 + m), periodicity: dayOfWeek } - } as any)).to.be.deep.equal((new Date(2019, 7, nextDay, h, m, 0)), 'for day: ' + dayOfWeek); + } as any)).to.be.deep.equal((new Date(Date.UTC(2019, 7, nextDay, h, m, 0))), 'for day: ' + dayOfWeek); h = 5; m = 10; @@ -46,10 +46,10 @@ describe('JobScheduleDTO', () => { expect(JobScheduleDTOUtils.getNextRunningDate(refDate, { trigger: { type: JobTriggerType.periodic, - atTime: (h * 60 + m) * 60 * 1000, + atTime: (h * 60 + m), periodicity: dayOfWeek } - } as any)).to.be.deep.equal((new Date(2019, 7, nextDay, h, m, 0)), 'for day: ' + dayOfWeek); + } as any)).to.be.deep.equal((new Date(Date.UTC(2019, 7, nextDay, h, m, 0))), 'for day: ' + dayOfWeek); } { @@ -58,10 +58,10 @@ describe('JobScheduleDTO', () => { expect(JobScheduleDTOUtils.getNextRunningDate(refDate, { trigger: { type: JobTriggerType.periodic, - atTime: (h * 60 + m) * 60 * 1000, + atTime: (h * 60 + m), periodicity: 7 } - } as any)).to.be.deep.equal((new Date(2019, 7, 18, h, m, 0))); + } as any)).to.be.deep.equal((new Date(Date.UTC(2019, 7, 18, h, m, 0)))); } { const h = 2; @@ -69,10 +69,10 @@ describe('JobScheduleDTO', () => { expect(JobScheduleDTOUtils.getNextRunningDate(refDate, { trigger: { type: JobTriggerType.periodic, - atTime: (h * 60 + m) * 60 * 1000, + atTime: (h * 60 + m), periodicity: 7 } - } as any)).to.be.deep.equal((new Date(2019, 7, 19, h, m, 0))); + } as any)).to.be.deep.equal((new Date(Date.UTC(2019, 7, 19, h, m, 0)))); } }); });