-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest.js
More file actions
40 lines (30 loc) · 917 Bytes
/
test.js
File metadata and controls
40 lines (30 loc) · 917 Bytes
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
describe('hang', function () {
'use strict';
var hang = require('./')
, assume = require('assume');
it('is exported as a function', function () {
assume(hang).is.a('function');
});
it('returns a function with the same name as the provided fn', function () {
var what = hang(function what() {});
assume(what.displayName).equals('what');
});
it('calls the supplied callback', function (next) {
var h = hang(next);
assume(h).does.not.equals(next);
h();
});
it('instantly calls the supplied function if called async', function (next) {
setImmediate(hang(next));
});
it('proxies the arguments and this value', function (next) {
var fn = hang(function (a, b, c) {
assume(a).equals('a');
assume(b).equals('b');
assume(c).equals('c');
assume(this).equals('foo');
next();
});
fn.apply('foo', ['a', 'b', 'c']);
});
});