mirror of https://github.com/IoTcat/FDC.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
719 B
22 lines
719 B
var util = require('util'); |
|
var sinon = require('sinon'); |
|
var test = require('tap').test; |
|
var CronExpression = require('../lib/expression'); |
|
|
|
test('increment_on_first_itereation', function(t) { |
|
try { |
|
var clock = sinon.useFakeTimers(); |
|
var fake_now = new Date('Tue Feb 21 2017 16:45:00'); |
|
clock.tick(fake_now.getTime()); |
|
var interval = CronExpression.parse('* * * * *'); |
|
t.ok(interval, 'Interval parsed'); |
|
var next = interval.next(); |
|
t.ok(next, 'Found next scheduled interval'); |
|
// Make sure next has incremented in 1 minute |
|
t.equal(fake_now.getTime() + 60000, next.getTime()); |
|
clock.restore(); |
|
t.end(); |
|
} catch (err) { |
|
t.ifError(err, 'Interval parse error'); |
|
} |
|
});
|
|
|