Skip to content

Commit

Permalink
daily test utc.
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Campbell <nicholas.j.campbell@gmail.com>
  • Loading branch information
ncb000gt committed Aug 5, 2018
1 parent 2163d1e commit d2e0ab2
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/test-cron.js
Expand Up @@ -736,6 +736,37 @@ describe('cron', function() {
expect(c).to.eql(8);
});

it('should run every day UTC', function() {
var c = 0;
var d = new Date('12/31/2014');
d.setSeconds(0);
d.setMinutes(0);
d.setHours(0);
var clock = sinon.useFakeTimers(d.getTime());

var job = new cron.CronJob({
cronTime: '00 30 00 * * *',
onTick: function() {
c++;
},
start: true,
timeZone: 'UTC'
});

var day = 24 * 60 * 60 * 1000;
clock.tick(day);
expect(c).to.eql(1);
clock.tick(day);
expect(c).to.eql(2);
clock.tick(day);
expect(c).to.eql(3);
clock.tick(5 * day);

clock.restore();
job.stop();
expect(c).to.eql(8);
});

it('should run every second monday');

describe('with utcOffset', function() {
Expand Down

0 comments on commit d2e0ab2

Please sign in to comment.