app.js
This file
Path
test/app.js
95 lines · 2.2 KiB · JavaScript
Last changed by
Merge tag '3.8.0'Douglas Christopher Wilsonbefore adoptiondb4a061
History of this fileTake it
The walk stopped after 200 commits: lines older than 2e68ddb point at it.
expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb
lines 1–27why, one step back12var express = require('../')3 , assert = require('assert');45describe('app', function(){6 it('should inherit from event emitter', function(done){7 var app = express();8 app.on('foo', done);9 app.emit('foo');10 })11})1213describe('app.parent', function(){14 it('should return the parent when mounted', function(){15 var app = express()16 , blog = express()17 , blogAdmin = express();1819 app.use('/blog', blog);20 blog.use('/admin', blogAdmin);2122 assert(!app.parent, 'app.parent');23 blog.parent.should.equal(app);24 blogAdmin.parent.should.equal(blog);25 })26})27remove app.router and refactor middleware processingRoman Shtylmanbefore adoptionf41d09a
line 28why, one step back28describe('app.mountpath', function(){expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb
lines 29–36why, one step back29 it('should return the mounted path', function(){30 var app = express()31 , blog = express()32 , blogAdmin = express();3334 app.use('/blog', blog);35 blog.use('/admin', blogAdmin);36remove app.router and refactor middleware processingRoman Shtylmanbefore adoptionf41d09a
lines 37–51why, one step back37 app.mountpath.should.equal('/');38 blog.mountpath.should.equal('/blog');39 blogAdmin.mountpath.should.equal('/admin');40 })41})4243describe('app.router', function(){44 it('should throw with notice', function(done){45 var app = express()4647 try {48 app.router;49 } catch(err) {50 done();51 }expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb
lines 52–86why, one step back52 })53})5455describe('app.path()', function(){56 it('should return the canonical', function(){57 var app = express()58 , blog = express()59 , blogAdmin = express();6061 app.use('/blog', blog);62 blog.use('/admin', blogAdmin);6364 app.path().should.equal('');65 blog.path().should.equal('/blog');66 blogAdmin.path().should.equal('/blog/admin');67 })68})6970describe('in development', function(){71 it('should disable "view cache"', function(){72 process.env.NODE_ENV = 'development';73 var app = express();74 app.enabled('view cache').should.be.false;75 process.env.NODE_ENV = 'test';76 })77})7879describe('in production', function(){80 it('should enable "view cache"', function(){81 process.env.NODE_ENV = 'production';82 var app = express();83 app.enabled('view cache').should.be.true;84 process.env.NODE_ENV = 'test';85 })86})Merge tag '3.8.0'Douglas Christopher Wilsonbefore adoptiondb4a061
lines 87–95why, one step back8788describe('without NODE_ENV', function(){89 it('should default to development', function(){90 process.env.NODE_ENV = '';91 var app = express();92 app.get('env').should.equal('development');93 process.env.NODE_ENV = 'test';94 })95})