-
Notifications
You must be signed in to change notification settings - Fork 159
/
Copy pathfastboot-response-test.js
45 lines (37 loc) · 1.25 KB
/
fastboot-response-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
var expect = require('chai').expect;
var FastBootHeaders = require('./../src/fastboot-headers.js');
var FastBootResponse = require('./../src/fastboot-response.js');
describe('FastBootResponse', function() {
var fastBootResponse;
beforeEach(function() {
var mockResponse = {
getHeaders() {
return {
'i-am-a': ['mock header', 'me too'],
cookie: '',
};
},
};
fastBootResponse = new FastBootResponse(mockResponse);
});
describe('headers', function() {
it('should have headers', function() {
expect(fastBootResponse).to.have.ownProperty('headers');
});
it('should be an instance of FastBootHeaders', function() {
expect(fastBootResponse.headers).to.be.an.instanceOf(FastBootHeaders);
});
it("should contain the original response's headers", function() {
var header = fastBootResponse.headers.getAll('i-am-a');
expect(header).to.deep.equal(['mock header', 'me too']);
});
});
describe('statusCode', function() {
it('should have a statusCode', function() {
expect(fastBootResponse).to.have.ownProperty('statusCode');
});
it('should default to 200', function() {
expect(fastBootResponse.statusCode).to.equal(200);
});
});
});