diff --git a/test/request/query.js b/test/request/query.js index 30f47af..5fba3f4 100644 --- a/test/request/query.js +++ b/test/request/query.js @@ -2,12 +2,13 @@ 'use strict'; const context = require('../helpers/context'); +const should = require('should'); describe('ctx.query', () => { describe('when missing', () => { it('should return an empty object', () => { const ctx = context({ url: '/' }); - ctx.query.should.eql({}); + should(ctx.query).empty; }); it('should return the same object each time it\'s accessed', done => { diff --git a/test/request/querystring.js b/test/request/querystring.js index fcda988..b6ad167 100644 --- a/test/request/querystring.js +++ b/test/request/querystring.js @@ -3,6 +3,7 @@ const context = require('../helpers/context'); const parseurl = require('parseurl'); +const should = require('should'); describe('ctx.querystring', () => { it('should return the querystring', () => { @@ -32,10 +33,8 @@ describe('ctx.querystring=', () => { 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', () => { diff --git a/test/request/search.js b/test/request/search.js index 02135d0..7bd5485 100644 --- a/test/request/search.js +++ b/test/request/search.js @@ -2,6 +2,7 @@ 'use strict'; const context = require('../helpers/context'); +const should = require('should'); describe('ctx.search=', () => { it('should replace the search', () => { @@ -16,10 +17,8 @@ describe('ctx.search=', () => { 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', () => { diff --git a/test/response/attachment.js b/test/response/attachment.js index ffd6aa6..7721d07 100644 --- a/test/response/attachment.js +++ b/test/response/attachment.js @@ -27,7 +27,7 @@ describe('ctx.attachment([filename])', () => { it('should set the encodeURI filename param', () => { const ctx = context(); ctx.attachment('path/to/include-no-ascii-char-中文名-ok.png'); - const str = 'attachment; filename=\"include-no-ascii-char-???-ok.png\"; filename*=UTF-8\'\'include-no-ascii-char-%E4%B8%AD%E6%96%87%E5%90%8D-ok.png'; + const str = 'attachment; filename="include-no-ascii-char-???-ok.png"; filename*=UTF-8\'\'include-no-ascii-char-%E4%B8%AD%E6%96%87%E5%90%8D-ok.png'; ctx.response.header['content-disposition'].should.equal(str); });