1 | chai = require 'chai'
|
2 | chai.should()
|
3 | cronclock = require "./../cronclock.coffee"
|
4 |
|
5 | describe "#init", ()->
|
6 | it "checks past timers", (done) ->
|
7 | date = new Date();
|
8 | date.setYear(2000);
|
9 | cronclock.add(date, ()-> done())
|
10 | cronclock.init()
|
11 | it "set future timers", () ->
|
12 | date = new Date( Date.now() + 1000 )
|
13 | timeout = Date.now();
|
14 | index = cronclock.add(date, ()->
|
15 | Date.now().should.be.equal(timeout)
|
16 | )
|
17 | index.should.be.equal("#{Math.round(date/60000)}:0")
|