2014-10-01 12:12:20 +00:00
|
|
|
|
2015-10-11 22:59:51 +00:00
|
|
|
'use strict';
|
|
|
|
|
2017-05-11 03:30:32 +00:00
|
|
|
const assert = require('assert');
|
2015-10-12 04:59:30 +00:00
|
|
|
const response = require('../helpers/context').response;
|
2014-10-01 12:12:20 +00:00
|
|
|
|
2015-10-25 07:54:57 +00:00
|
|
|
describe('res.message', () => {
|
|
|
|
it('should return the response status message', () => {
|
2015-10-05 18:23:47 +00:00
|
|
|
const res = response();
|
2014-10-01 12:12:20 +00:00
|
|
|
res.status = 200;
|
2017-05-11 03:30:32 +00:00
|
|
|
assert.equal(res.message, 'OK');
|
2015-10-12 20:36:41 +00:00
|
|
|
});
|
2014-10-01 12:12:20 +00:00
|
|
|
|
2015-10-25 07:54:57 +00:00
|
|
|
describe('when res.message not present', () => {
|
|
|
|
it('should look up in statuses', () => {
|
2015-10-05 18:23:47 +00:00
|
|
|
const res = response();
|
2014-10-01 12:12:20 +00:00
|
|
|
res.res.statusCode = 200;
|
2017-05-11 03:30:32 +00:00
|
|
|
assert.equal(res.message, 'OK');
|
2015-10-12 20:36:41 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2014-10-01 12:12:20 +00:00
|
|
|
|
2015-10-25 07:54:57 +00:00
|
|
|
describe('res.message=', () => {
|
|
|
|
it('should set response status message', () => {
|
2015-10-05 18:23:47 +00:00
|
|
|
const res = response();
|
2014-10-01 12:12:20 +00:00
|
|
|
res.status = 200;
|
|
|
|
res.message = 'ok';
|
2017-05-11 03:30:32 +00:00
|
|
|
assert.equal(res.res.statusMessage, 'ok');
|
|
|
|
assert.equal(res.inspect().message, 'ok');
|
2015-10-12 20:36:41 +00:00
|
|
|
});
|
|
|
|
});
|