mirror of
https://github.com/zebrajr/express.git
synced 2025-12-06 12:19:51 +01:00
Added middleware usage test
This commit is contained in:
parent
84fc19a75f
commit
2bea014e89
|
|
@ -18,9 +18,9 @@ exports.version = '0.14.0';
|
|||
var Server = require('./server');
|
||||
|
||||
/**
|
||||
* Shortcut for `new Server(middleware)`.
|
||||
* Shortcut for `new Server(...)`.
|
||||
*
|
||||
* @param {Array} middleware
|
||||
* @param {Function} ...
|
||||
* @return {Server}
|
||||
* @api public
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -34,6 +34,19 @@ module.exports = {
|
|||
{ body: 'updated user 12' });
|
||||
},
|
||||
|
||||
'test middleware': function(assert){
|
||||
var app = express.createServer();
|
||||
|
||||
app.get('/users', function(req, res, params, next){
|
||||
next(new Error('fail!!'));
|
||||
});
|
||||
app.use('/', connect.errorHandler({ showMessage: true }));
|
||||
|
||||
assert.response(app,
|
||||
{ url: '/users' },
|
||||
{ body: 'Error: fail!!' });
|
||||
},
|
||||
|
||||
'test #configure()': function(assert, beforeExit){
|
||||
var calls = [];
|
||||
var server = express.createServer();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user