fcs
2025-04-10 0163870d662dc5b7d69ceff977490ede594f7d82
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
'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);
    }
  }
};