mirror of
https://github.com/zebrajr/express.git
synced 2026-01-15 12:15:27 +00:00
38 lines
733 B
JavaScript
38 lines
733 B
JavaScript
|
|
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();
|
|
});
|
|
})
|
|
})
|
|
})
|