Skip to content
Myr

tests: add more tests

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parent c21226a · Browse files · 3 files+60 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+60 added−1 removed

  • tests:+60 added−1 removed

3 files+60 added−1 removed

modified:test/app.router.js+24 added
562 unmodified lines
563 })564 })565 })566567 describe('when next("route") is called', function(){568 it('should jump to next route', function(done){569 var app = express()570571 function fn(req, res, next){572 res.set('X-Hit', '1')573 next('route')574 }575576 app.get('/foo', fn, function(req, res, next){577 res.end('failure')578 });579580 app.get('/foo', function(req, res){581 res.end('success')582 })583584 request(app)585 .get('/foo')586 .expect('X-Hit', '1')587 .expect(200, 'success', done)588 })589 })590591 describe('when next(err) is called', function(){592 it('should break out of app.router', function(done){593 var app = express()594 , calls = [];
55 unmodified lines
modified:test/config.js+9 added
modified:test/utils.js+27 added-1 removed
12var utils = require('../lib/utils')3 , assert = require('assert');45describe('utils.deprecate(fn, msg)', function(){6 var env7 before(function(){8 env = process.env.NODE_ENV9 })10 after(function(){11 process.env.NODE_ENV = env12 })1314 it('should pass-through fn in test environment', function(){15 var fn = function(){}16 process.env.NODE_ENV = 'test'17 utils.deprecate(fn).should.equal(fn)18 })1920 it('should return new fn in other environment', function(){21 var fn = function(){}22 process.env.NODE_ENV = ''23 utils.deprecate(fn).should.not.equal(fn)24 })25})2627describe('utils.etag(body, encoding)', function(){28 it('should support strings', function(){29 utils.etag('express!')30 .should.eql('"zZdv4imtWD49AHEviejT6A=="')
44 unmodified lines
75 assert(utils.isAbsolute('c:\\'));76 assert(!utils.isAbsolute(':\\'));77 })7857 it('should unices', function(){79 it('should support windows unc', function(){80 assert(utils.isAbsolute('\\\\foo\\bar'))81 })8283 it('should support unices', function(){84 assert(utils.isAbsolute('/foo/bar'));85 assert(!utils.isAbsolute('foo/bar'));86 })87})
192 unmodified lines