-
Notifications
You must be signed in to change notification settings - Fork 22
/
test.js
36 lines (33 loc) · 820 Bytes
/
test.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
var test = require("tap").test;
var pna = require('./');
test('should work', function (t) {
t.plan(5);
pna.nextTick(function (a) {
t.ok(a);
pna.nextTick(function (thing) {
t.equals(thing, 7);
}, 7);
}, true);
pna.nextTick(function (a, b, c) {
t.equals(a, 'step');
t.equals(b, 3);
t.equals(c, 'profit');
}, 'step', 3, 'profit');
});
test('correct number of arguments', function (t) {
t.plan(1);
pna.nextTick(function () {
t.equals(2, arguments.length, 'correct number');
}, 1, 2);
});
test('uses the current value of process.nextTick', function (t) {
t.plan(1);
var oldNextTick = process.nextTick;
var called = false;
process.nextTick = function() {
called = true
};
pna.nextTick(function () {});
process.nextTick = oldNextTick;
t.ok(called);
});