Skip to content

Commit

Permalink
added test to confirm running every day.
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 89cccaa commit 2163d1e
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/test-cron.js
Expand Up @@ -706,6 +706,36 @@ describe('cron', function() {
expect(c).to.eql(2);
});

it('should run every day', 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
});

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 2163d1e

Please sign in to comment.