node-schedule 1.3.1 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/schedule.js CHANGED
@@ -90,7 +90,7 @@ function Job(name, job, callback) {
90
90
 
91
91
  cancelInvocation(inv);
92
92
 
93
- if (reschedule && inv.recurrenceRule.recurs) {
93
+ if (reschedule && (inv.recurrenceRule.recurs || inv.recurrenceRule.next)) {
94
94
  newInv = scheduleNextRecurrence(inv.recurrenceRule, this, inv.fireDate, inv.endDate);
95
95
  if (newInv !== null) {
96
96
  newInvs.push(newInv);
@@ -125,7 +125,7 @@ function Job(name, job, callback) {
125
125
 
126
126
  cancelInvocation(nextInv);
127
127
 
128
- if (reschedule && nextInv.recurrenceRule.recurs) {
128
+ if (reschedule && (nextInv.recurrenceRule.recurs || nextInv.recurrenceRule.next)) {
129
129
  newInv = scheduleNextRecurrence(nextInv.recurrenceRule, this, nextInv.fireDate, nextInv.endDate);
130
130
  if (newInv !== null) {
131
131
  this.trackInvocation(newInv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-schedule",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "A cron-like and not-cron-like job scheduler for Node.",
5
5
  "keywords": [
6
6
  "schedule",
package/test/job-test.js CHANGED
@@ -381,6 +381,44 @@ module.exports = {
381
381
 
382
382
  clock.tick(2250);
383
383
  },
384
+ "Cancelled job reschedules": function(test) {
385
+ test.expect(1);
386
+ var ok = false;
387
+
388
+ var job = schedule.scheduleJob('*/1 * * * * *', function () {});
389
+
390
+ setTimeout(function() {
391
+ job.cancel(true);
392
+ if (job.nextInvocation() !== null) ok = true;
393
+ }, 1250);
394
+
395
+ setTimeout(function() {
396
+ job.cancel();
397
+ test.ok(ok);
398
+ test.done();
399
+ }, 2250);
400
+
401
+ clock.tick(2250);
402
+ },
403
+ "CancelNext job reschedules": function(test) {
404
+ test.expect(1);
405
+ var ok = false;
406
+
407
+ var job = schedule.scheduleJob('*/1 * * * * *', function () {});
408
+
409
+ setTimeout(function() {
410
+ job.cancelNext();
411
+ if (job.nextInvocation() !== null) ok = true;
412
+ }, 1250);
413
+
414
+ setTimeout(function() {
415
+ job.cancel();
416
+ test.ok(ok);
417
+ test.done();
418
+ }, 2250);
419
+
420
+ clock.tick(2250);
421
+ },
384
422
  "Job emits 'canceled' event": function(test) {
385
423
  test.expect(1);
386
424