node-schedule
Advanced tools
Comparing version 0.5.0 to 0.5.1
@@ -36,6 +36,8 @@ | ||
// Check for generator | ||
if (typeof this.job === 'function' && this.job.prototype.next) { | ||
if (typeof this.job === 'function' && | ||
this.job.prototype && | ||
this.job.prototype.next) { | ||
this.job = function() { | ||
return this.next().value; | ||
}.bind(this.job()); | ||
}.bind(this.job.call(this)); | ||
} | ||
@@ -42,0 +44,0 @@ |
{ | ||
"name": "node-schedule", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "A cron-like and not-cron-like job scheduler for Node.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -18,4 +18,17 @@ | ||
}, 3250); | ||
}, | ||
jobContextInGenerator: function(test) { | ||
test.expect(1); | ||
var job = new schedule.Job('name of job', function*() { | ||
test.ok(this.name === 'name of job'); | ||
}); | ||
job.runOnDate(new Date(Date.now() + 3000)); | ||
setTimeout(function() { | ||
test.done(); | ||
}, 3250); | ||
} | ||
} | ||
} |
@@ -100,2 +100,13 @@ | ||
}, | ||
"Context is passed into generator correctly": function(test) { | ||
if (!es6) { | ||
test.expect(0); | ||
test.done(); | ||
return; | ||
} | ||
es6.jobContextInGenerator(test); | ||
clock.tick(3250); | ||
}, | ||
/* No jobs will run after this test for some reason - hide for now | ||
@@ -102,0 +113,0 @@ "Won't run job if scheduled in the past": function(test) { |
51001
1525