9f27c1c414
change var to const for static require()'d modules make constant var references in app use const keyword refactor context to use es6 constants refactor request to use es6 constants, let block-scope coming next use const in response object for static refs make context tests use es6 constants experimental unit tests -> const use const for static references in unit test over req use const for static refs in res tests update app tests to use const for static refs make the context test use es6 constants for static refs use constants in the README es6 constants seem to work in --harmony on 0.12 too use const's for immutable refs in benchmarks ensure all JS files have blank newline at top add newline to bottom of file where missing add a webchat freenode link to irc channel no need to assign error in catch{}-able test app.silent option to turn off err logging keep test env logging for backwards-compat
31 lines
776 B
JavaScript
31 lines
776 B
JavaScript
|
|
'use strict';
|
|
|
|
const response = require('../context').response;
|
|
const Stream = require('stream');
|
|
|
|
describe('res.message', function(){
|
|
it('should return the response status message', function(){
|
|
const res = response();
|
|
res.status = 200;
|
|
res.message.should.equal('OK');
|
|
})
|
|
|
|
describe('when res.message not present', function(){
|
|
it('should look up in statuses', function(){
|
|
const res = response();
|
|
res.res.statusCode = 200;
|
|
res.message.should.equal('OK');
|
|
})
|
|
})
|
|
})
|
|
|
|
describe('res.message=', function(){
|
|
it('should set response status message', function(){
|
|
const res = response();
|
|
res.status = 200;
|
|
res.message = 'ok';
|
|
res.res.statusMessage.should.equal('ok');
|
|
res.inspect().message.should.equal('ok');
|
|
})
|
|
})
|