Skip to content
Browse files

Add test case for long wait

When scheduling a job 32 days into the future, we should not get the
callback within 250 ms.
  • Loading branch information...
1 parent 355d5cf commit cca07d9cd2a7a3acae734f46956f3cbdb1319444 @calmh calmh committed Jul 3, 2012
Showing with 14 additions and 0 deletions.
  1. +14 −0 tests/test-cron.js
View
14 tests/test-cron.js
@@ -293,5 +293,19 @@ module.exports = testCase({
assert.equal(count, 1);
assert.done();
}, 5250);
+ },
+ 'test long wait should not fire immediately': function(assert) {
+ assert.expect(1);
+ var count = 0;
+ var d = new Date().getTime() + 31 * 86400 * 1000;
+ var job = cron.job(new Date(d), function() {
+ assert.ok(false);
+ });
+ job.start();
+ setTimeout(function() {
+ job.stop();
+ assert.ok(true);
+ assert.done();
+ }, 250);
}
});

0 comments on commit cca07d9

Please sign in to comment.
Something went wrong with that request. Please try again.