-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.js
63 lines (49 loc) · 1.34 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
describe('xhr-response', function () {
'use strict';
var assume = require('assume')
, response = require('./');
it('is exported as a function', function () {
assume(response).is.a('function');
});
it('defaults to the `reponse` property when available', function () {
var wat = response({
response: 'wat',
responseText: 'lol'
});
assume(wat).equals('wat');
});
it('does not access the `responseText` for `blob` types', function () {
var wat = response({
responseText: 'lol',
responseType: 'blob'
});
assume(wat).is.a('undefined');
});
it('does not access the `responseText` during load for moz-chunked-* calls', function () {
var wat = response({
responseText: 'lol',
responseType: 'moz-chunked-text',
readyState: 4
});
assume(wat).is.a('undefined');
wat = response({
responseText: 'lol',
responseType: 'moz-chunked-text',
readyState: 3
});
assume(wat).equals('lol');
wat = response({
responseText: 'lol',
responseType: 'moz-chunked-arraybuffer',
readyState: 4
});
assume(wat).is.a('undefined');
});
it('returns the responseXML if there is no text', function () {
var wat = response({
responseText: '',
responseXML: '<xml>'
});
assume(wat).equals('<xml>');
});
});