require('proof')(10, prove)

function prove (assert) {
    var Scheduler = require('..')

    var time = 0, scheduler

    scheduler = new Scheduler({ setTimeout: false })
    scheduler = new Scheduler
    scheduler = new Scheduler({ Date: { now: function () { return time } } })

    assert(scheduler.next(), null, 'nothing happening')

    scheduler.schedule(time + 1, 'a', function () {})
    scheduler.schedule(time + 1, 'b', function () {})

    assert(scheduler.scheduled('a'), time + 1, 'scheduled')

    assert(scheduler.next(), 1, 'next')

    assert(scheduler.what.a.when, 1, 'delay a')
    assert(scheduler.what.b.when, 1, 'delay b')

    scheduler.unschedule('a')
    scheduler.unschedule('b')

    assert(scheduler.what, {}, 'empty')

    scheduler.schedule(time + 1, 'a', function () {})
    scheduler.schedule(time + 1, 'b', function () {})

    assert(scheduler.check(time), 0, 'nothing happening')
    time++
    assert(scheduler.check(time), 2, 'something happening')

    scheduler.schedule(time + 1, 'a', function () {})
    scheduler.schedule(time + 1, 'b', function () {})

    scheduler.clear()
    assert(scheduler.what, {}, 'clear')

    scheduler.schedule(time, 'a', function () {
        assert('immediate')
    })
}

@@ -11,17 +11,17 @@
 roof')(1
-0
+1
 , prove)
@@ -321,32 +321,107 @@
 hing happening')
+%0A    assert(scheduler.scheduled('a'), null, 'specific event not scheduled')
 %0A%0A    scheduler.

Test `scheduled` with unscheduled event.