Permalink
Browse files

Added req.query tests

  • Loading branch information...
1 parent 6bee32c commit ddeee9b6dbcd282350163875ad559ad7a1f32229 @tj tj committed Nov 9, 2011
Showing with 37 additions and 0 deletions.
  1. +37 −0 test/req.query.js
View
37 test/req.query.js
@@ -0,0 +1,37 @@
+
+var express = require('../')
+ , request = require('./support/http');
+
+describe('req', function(){
+ describe('.query', function(){
+ it('should default to {}', function(done){
+ var app = express();
+
+ app.use(function(req, res){
+ req.query.should.eql({});
+ res.end();
+ });
+
+ request(app)
+ .get('/')
+ .end(function(res){
+ done();
+ });
+ })
+
+ it('should contain the parsed query-string', function(done){
+ var app = express();
+
+ app.use(function(req, res){
+ req.query.should.eql({ user: { name: 'tj' }});
+ res.end();
+ });
+
+ request(app)
+ .get('/?user[name]=tj')
+ .end(function(res){
+ done();
+ });
+ })
+ })
+})

0 comments on commit ddeee9b

Please sign in to comment.