-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest.js
More file actions
46 lines (39 loc) · 1.01 KB
/
test.js
File metadata and controls
46 lines (39 loc) · 1.01 KB
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
'use strict';
var test = require('tape'),
delay = require('./');
test('when given no arguments', { timeout: 5 }, function(t) {
t.plan(1);
delay()
.then(function() {
t.pass('should resolve after 0ms');
t.end();
})
.catch(function() {
t.fail('should resolve');
t.end();
});
});
test('when given a timeout in ms', { timeout: 15 }, function(t) {
t.plan(1);
delay(10)
.then(function() {
t.pass('should resolve after given ms');
t.end();
})
.catch(function() {
t.fail('should resolve');
t.end();
});
});
test('when given a timeout and additional args', { timeout: 15 }, function(t) {
t.plan(1);
delay(10, 'foo')
.then(function(val) {
t.equal(val, 'foo', 'should resolve with given args');
t.end();
})
.catch(function() {
t.fail('should resolve');
t.end();
});
});