Merge pull request #483 from squarejaw/test-coverage
Increase test coverage
This commit is contained in:
commit
2359b6a769
2 changed files with 21 additions and 0 deletions
|
@ -18,5 +18,12 @@ describe('req.ip', function(){
|
||||||
req.socket.remoteAddress = '127.0.0.2';
|
req.socket.remoteAddress = '127.0.0.2';
|
||||||
req.ip.should.equal('127.0.0.2');
|
req.ip.should.equal('127.0.0.2');
|
||||||
})
|
})
|
||||||
|
describe('with req.socket.remoteAddress not present', function() {
|
||||||
|
it('should return an empty string', function(){
|
||||||
|
var req = request();
|
||||||
|
req.socket.remoteAddress = null;
|
||||||
|
req.ip.should.equal('');
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,6 +1,20 @@
|
||||||
|
|
||||||
var context = require('../context');
|
var context = require('../context');
|
||||||
|
|
||||||
|
describe('ctx.querystring', function(){
|
||||||
|
it('should return the querystring', function () {
|
||||||
|
var ctx = context({ url: '/store/shoes?page=2&color=blue' });
|
||||||
|
ctx.querystring.should.equal('page=2&color=blue');
|
||||||
|
})
|
||||||
|
describe('when ctx.req not present', function() {
|
||||||
|
it('should return an empty string', function (){
|
||||||
|
var ctx = context();
|
||||||
|
ctx.request.req = null;
|
||||||
|
ctx.querystring.should.equal('');
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
describe('ctx.querystring=', function(){
|
describe('ctx.querystring=', function(){
|
||||||
it('should replace the querystring', function(){
|
it('should replace the querystring', function(){
|
||||||
var ctx = context({ url: '/store/shoes' });
|
var ctx = context({ url: '/store/shoes' });
|
||||||
|
|
Loading…
Reference in a new issue