2014-07-06 08:43:14 +00:00
|
|
|
|
2015-10-11 22:59:51 +00:00
|
|
|
'use strict';
|
|
|
|
|
2015-10-12 04:59:30 +00:00
|
|
|
const response = require('../helpers/context').response;
|
2015-10-05 18:23:47 +00:00
|
|
|
const assert = require('assert');
|
2014-07-06 08:43:14 +00:00
|
|
|
|
|
|
|
describe('res.inspect()', function(){
|
|
|
|
describe('with no response.res present', function(){
|
|
|
|
it('should return null', function(){
|
2015-10-05 18:23:47 +00:00
|
|
|
const res = response();
|
2014-07-06 08:43:14 +00:00
|
|
|
res.body = 'hello';
|
|
|
|
delete res.res;
|
|
|
|
assert(null == res.inspect());
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should return a json representation', function(){
|
2015-10-05 18:23:47 +00:00
|
|
|
const res = response();
|
2014-07-06 08:43:14 +00:00
|
|
|
res.body = 'hello';
|
|
|
|
|
|
|
|
res.inspect().should.eql({
|
|
|
|
body: 'hello',
|
|
|
|
status: 200,
|
2014-10-01 12:12:20 +00:00
|
|
|
message: 'OK',
|
2014-07-06 08:43:14 +00:00
|
|
|
header: {
|
|
|
|
'content-length': '5',
|
|
|
|
'content-type': 'text/plain; charset=utf-8'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
})
|
|
|
|
})
|