Skip to content

Commit

Permalink
Added req.route test
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Nov 25, 2011
1 parent 15e7218 commit c3d96df
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/req.route.js
@@ -0,0 +1,27 @@

var express = require('../')
, request = require('./support/http');

describe('req', function(){
describe('.route', function(){
it('should be the executed Route', function(done){
var app = express();

app.get('/user/:id/:op?', function(req, res, next){
req.route.method.should.equal('get');
req.route.path.should.equal('/user/:id/:op?');
next();
});

app.get('/user/:id/edit', function(req, res){
req.route.method.should.equal('get');
req.route.path.should.equal('/user/:id/edit');
res.end();
});

request(app)
.get('/user/12/edit')
.expect(200, done);
})
})
})

0 comments on commit c3d96df

Please sign in to comment.