-
Notifications
You must be signed in to change notification settings - Fork 6
/
named.js
46 lines (32 loc) · 1017 Bytes
/
named.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*jshint expr: true*/
var should = require('should')
var Timer = require('../lib/timer')
describe('The Timer function', function () {
var foo
before(function () {
foo = Timer.get('foo')
})
describe('get static method', function () {
it('should create a new Timer if it does not exist', function () {
Timer.get('bar')
.should.be.an.instanceof(Timer)
.and.should.not.equal(foo)
Timer.destroy('bar')
})
it('should return a reference to an existing named timer', function () {
Timer.get('foo').should.equal(foo)
})
})
describe('destroy static method', function () {
it('should destroy a named timer', function () {
Timer.destroy('foo')
Timer.get('foo').should.not.equal(foo)
})
it('should return true if the timer existed', function () {
Timer.destroy('foo').should.be.true
})
it('should return false if the timer did not exist', function () {
Timer.destroy('bar').should.be.false
})
})
})