app.use.js
This file
Path
test/app.use.js
68 lines · 1.3 KiB · JavaScript
Last changed by
Fix "trust proxy" setting to inherit when app is mountedDouglas Christopher Wilsonbefore adoptionb40e74d
History of this fileTake it
The walk stopped after 200 commits: lines older than 9f4968a point at it.
3.15.1Douglas Christopher Wilsonbefore adoption9f4968a
line 1why, one step back1Fix "trust proxy" setting to inherit when app is mountedDouglas Christopher Wilsonbefore adoptionb40e74d
lines 2–4why, one step back2var assert = require('assert');3var express = require('..');4var request = require('supertest');3.15.1Douglas Christopher Wilsonbefore adoption9f4968a
lines 5–68why, one step back56describe('app', function(){7 it('should emit "mount" when mounted', function(done){8 var blog = express()9 , app = express();1011 blog.on('mount', function(arg){12 arg.should.equal(app);13 done();14 });1516 app.use(blog);17 })1819 describe('.use(app)', function(){20 it('should mount the app', function(done){21 var blog = express()22 , app = express();2324 blog.get('/blog', function(req, res){25 res.end('blog');26 });2728 app.use(blog);2930 request(app)31 .get('/blog')32 .expect('blog', done);33 })3435 it('should support mount-points', function(done){36 var blog = express()37 , forum = express()38 , app = express();3940 blog.get('/', function(req, res){41 res.end('blog');42 });4344 forum.get('/', function(req, res){45 res.end('forum');46 });4748 app.use('/blog', blog);49 app.use('/forum', forum);5051 request(app)52 .get('/blog')53 .expect('blog', function(){54 request(app)55 .get('/forum')56 .expect('forum', done);57 });58 })5960 it('should set the child\'s .parent', function(){61 var blog = express()62 , app = express();6364 app.use('/blog', blog);65 blog.parent.should.equal(app);66 })67 })68})