e8f79d43f9
closes #517 add index test for Application add app.toJSON test add test for app.inspect() add tests for app.use() add tests for app.onerror() add tests for app.respond() add tests for app.context() add tests for app.request() add tests for app.response refactor for non-existence of test/app...js no need for *.js use helpers/ dir for non-tests
31 lines
686 B
JavaScript
31 lines
686 B
JavaScript
|
|
'use strict';
|
|
|
|
const request = require('../helpers/context').request;
|
|
const assert = require('assert');
|
|
|
|
describe('req.inspect()', function(){
|
|
describe('with no request.req present', function(){
|
|
it('should return null', function(){
|
|
const req = request();
|
|
req.method = 'GET';
|
|
delete req.req;
|
|
assert(null == req.inspect());
|
|
})
|
|
})
|
|
|
|
it('should return a json representation', function(){
|
|
const req = request();
|
|
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'
|
|
}
|
|
});
|
|
})
|
|
})
|