Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion test/request/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
'use strict';

var context = require('../context');
var should = require('should');

describe('ctx.query', function(){
describe('when missing', function(){
it('should return an empty object', function(){
var ctx = context({ url: '/' });
ctx.query.should.eql({});
should(ctx.query).empty;
})

it('should return the same object each time it\'s accessed', function(done) {
Expand Down
7 changes: 3 additions & 4 deletions test/request/querystring.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

var context = require('../context');
var parseurl = require('parseurl');
var should = require('should');

describe('ctx.querystring', function(){
it('should return the querystring', function(){
Expand Down Expand Up @@ -32,10 +33,8 @@ describe('ctx.querystring=', function(){
ctx.querystring = 'page=2&color=blue';
ctx.url.should.equal('/store/shoes?page=2&color=blue');
ctx.search.should.equal('?page=2&color=blue');
ctx.query.should.eql({
page: '2',
color: 'blue'
});
should(ctx.query).have.property('page', '2');
should(ctx.query).have.property('color', 'blue');
})

it('should change .url but not .originalUrl', function(){
Expand Down
7 changes: 3 additions & 4 deletions test/request/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
'use strict';

var context = require('../context');
var should = require('should');

describe('ctx.search=', function(){
it('should replace the search', function(){
Expand All @@ -16,10 +17,8 @@ describe('ctx.search=', function(){
ctx.search = '?page=2&color=blue';
ctx.url.should.equal('/store/shoes?page=2&color=blue');
ctx.querystring.should.equal('page=2&color=blue');
ctx.query.should.eql({
page: '2',
color: 'blue'
});
should(ctx.query).have.property('page', '2');
should(ctx.query).have.property('color', 'blue');
})

it('should change .url but not .originalUrl', function(){
Expand Down