Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added `req.route` test

  • Loading branch information...
commit c3d96df0f013e7a2f72756127acee254e7a459ae 1 parent 15e7218
@tj tj authored
Showing with 27 additions and 0 deletions.
  1. +27 −0 test/req.route.js
View
27 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);
+ })
+ })
+})
Please sign in to comment.
Something went wrong with that request. Please try again.