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 request = require('../helpers/context').request;
|
2015-10-05 18:23:47 +00:00
|
|
|
const assert = require('assert');
|
2014-07-06 08:43:14 +00:00
|
|
|
|
2015-10-25 07:54:57 +00:00
|
|
|
describe('req.inspect()', () => {
|
|
|
|
describe('with no request.req present', () => {
|
|
|
|
it('should return null', () => {
|
2015-10-05 18:23:47 +00:00
|
|
|
const req = request();
|
2014-07-06 08:43:14 +00:00
|
|
|
req.method = 'GET';
|
|
|
|
delete req.req;
|
|
|
|
assert(null == req.inspect());
|
2015-10-12 20:36:41 +00:00
|
|
|
});
|
|
|
|
});
|
2014-07-06 08:43:14 +00:00
|
|
|
|
2015-10-25 07:54:57 +00:00
|
|
|
it('should return a json representation', () => {
|
2015-10-05 18:23:47 +00:00
|
|
|
const req = request();
|
2014-07-06 08:43:14 +00:00
|
|
|
req.method = 'GET';
|
|
|
|
req.url = 'example.com';
|
|
|
|
req.header.host = 'example.com';
|
|
|
|
|
|
|
|
req.inspect().should.eql({
|
|
|
|
method: 'GET',
|
|
|
|
url: 'example.com',
|
|
|
|
header: {
|
|
|
|
host: 'example.com'
|
|
|
|
}
|
|
|
|
});
|
2015-10-12 20:36:41 +00:00
|
|
|
});
|
|
|
|
});
|