mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
Fixing JobSchedule tests #273
This commit is contained in:
parent
e51502e318
commit
20f4e8735a
@ -5,7 +5,7 @@ describe('JobScheduleDTO', () => {
|
|||||||
|
|
||||||
it('should get date from schedule', async () => {
|
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, {
|
expect(JobScheduleDTOUtils.getNextRunningDate(refDate, {
|
||||||
@ -24,10 +24,10 @@ describe('JobScheduleDTO', () => {
|
|||||||
expect(JobScheduleDTOUtils.getNextRunningDate(refDate, {
|
expect(JobScheduleDTOUtils.getNextRunningDate(refDate, {
|
||||||
trigger: {
|
trigger: {
|
||||||
type: JobTriggerType.periodic,
|
type: JobTriggerType.periodic,
|
||||||
atTime: (h * 60 + m) * 60 * 1000,
|
atTime: (h * 60 + m),
|
||||||
periodicity: dayOfWeek
|
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;
|
h = 2;
|
||||||
m = 5;
|
m = 5;
|
||||||
@ -35,10 +35,10 @@ describe('JobScheduleDTO', () => {
|
|||||||
expect(JobScheduleDTOUtils.getNextRunningDate(refDate, {
|
expect(JobScheduleDTOUtils.getNextRunningDate(refDate, {
|
||||||
trigger: {
|
trigger: {
|
||||||
type: JobTriggerType.periodic,
|
type: JobTriggerType.periodic,
|
||||||
atTime: (h * 60 + m) * 60 * 1000,
|
atTime: (h * 60 + m),
|
||||||
periodicity: dayOfWeek
|
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;
|
h = 5;
|
||||||
m = 10;
|
m = 10;
|
||||||
@ -46,10 +46,10 @@ describe('JobScheduleDTO', () => {
|
|||||||
expect(JobScheduleDTOUtils.getNextRunningDate(refDate, {
|
expect(JobScheduleDTOUtils.getNextRunningDate(refDate, {
|
||||||
trigger: {
|
trigger: {
|
||||||
type: JobTriggerType.periodic,
|
type: JobTriggerType.periodic,
|
||||||
atTime: (h * 60 + m) * 60 * 1000,
|
atTime: (h * 60 + m),
|
||||||
periodicity: dayOfWeek
|
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, {
|
expect(JobScheduleDTOUtils.getNextRunningDate(refDate, {
|
||||||
trigger: {
|
trigger: {
|
||||||
type: JobTriggerType.periodic,
|
type: JobTriggerType.periodic,
|
||||||
atTime: (h * 60 + m) * 60 * 1000,
|
atTime: (h * 60 + m),
|
||||||
periodicity: 7
|
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;
|
const h = 2;
|
||||||
@ -69,10 +69,10 @@ describe('JobScheduleDTO', () => {
|
|||||||
expect(JobScheduleDTOUtils.getNextRunningDate(refDate, {
|
expect(JobScheduleDTOUtils.getNextRunningDate(refDate, {
|
||||||
trigger: {
|
trigger: {
|
||||||
type: JobTriggerType.periodic,
|
type: JobTriggerType.periodic,
|
||||||
atTime: (h * 60 + m) * 60 * 1000,
|
atTime: (h * 60 + m),
|
||||||
periodicity: 7
|
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))));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user