-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.js
37 lines (31 loc) · 846 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
37
describe('xhr-send', function () {
'use strict';
var send = require('./')
, assume = require('assume');
it('is exported as function', function () {
assume(send).is.a('function');
});
it('calls the supplied callback with an error', function (next) {
send(undefined, '', function (err) {
assume(err).is.instanceOf(Error);
next();
});
});
it('returns false when it fails', function () {
assume(send(undefined, '', function (err) {
assume(err).is.instanceOf(Error);
})).is.false();
});
it('calls xhr open with the supplied data', function (next) {
next = assume.plan(2, next);
var stub = {
send: function (data) {
assume(data).equals('foo');
}
};
send(stub, 'foo', function (err) {
assume(err).is.undefined();
next();
});
});
});