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.
25 lines
553 B
25 lines
553 B
5 years ago
|
'use strict';
|
||
|
|
||
|
var schedule = require('../lib/schedule');
|
||
|
|
||
|
module.exports = {
|
||
|
'Cancel Long Running Job': {
|
||
|
'should work even when recurring jobs are to be run on the past': function (test) {
|
||
|
var ok = true;
|
||
|
var job = schedule.scheduleJob('*/1 * * * * *', function () {
|
||
|
test.ok(ok);
|
||
|
var time = Date.now();
|
||
|
while (ok && (Date.now() - time < 2000)) {
|
||
|
}
|
||
|
});
|
||
|
|
||
|
test.ok(job);
|
||
|
setTimeout(function () {
|
||
|
job.cancel();
|
||
|
test.done();
|
||
|
ok = false;
|
||
|
}, 2100);
|
||
|
}
|
||
|
}
|
||
|
};
|