app.all.js
This file
Path
test/app.all.js
35 lines · 721 bytes · JavaScript
Last changed by
tests: add a missing test descriptionIgnacio Carbajobefore adoptionea6e4d3
History of this fileTake it
123456789101112131415161718192021222324252627282930313233343536
var express = require('../') , request = require('supertest');
describe('app.all()', function(){ it('should add a router per method', function(done){ var app = express();
app.all('/tobi', function(req, res){ res.end(req.method); });
request(app) .put('/tobi') .expect('PUT', function(){ request(app) .get('/tobi') .expect('GET', done); }); })
it('should run the callback for a method just once', function(done){ var app = express() , n = 0;
app.all('/*', function(req, res, next){ if (n++) return done(new Error('DELETE called several times')); next(); });
request(app) .del('/tobi') .expect(404, done); })})