2014-09-09 05:07:10 +00:00
|
|
|
|
2015-10-11 22:59:51 +00:00
|
|
|
'use strict';
|
|
|
|
|
2014-09-09 05:07:10 +00:00
|
|
|
var context = require('../context');
|
|
|
|
var assert = require('assert');
|
|
|
|
|
|
|
|
describe('ctx.assert(value, status)', function(){
|
|
|
|
it('should throw an error', function(){
|
|
|
|
var ctx = context();
|
|
|
|
|
|
|
|
try {
|
|
|
|
ctx.assert(false, 404);
|
|
|
|
throw new Error('asdf');
|
|
|
|
} catch (err) {
|
|
|
|
assert(404 == err.status);
|
|
|
|
assert(err.expose);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|