app.use.js
This file
Path
test/app.use.js
67 lines · 1.3 KiB · JavaScript
Last changed by
Not known.
History of this fileTake it
The walk stopped after 200 commits: lines older than 214f913 point at it.
mergeTJ Holowaychukbefore adoption214f913
lines 1–67why, one step back12var express = require('../')3 , request = require('./support/http');45describe('app', function(){6 it('should emit "mount" when mounted', function(done){7 var blog = express()8 , app = express();910 blog.on('mount', function(arg){11 arg.should.equal(app);12 done();13 });1415 app.use(blog);16 })1718 describe('.use(app)', function(){19 it('should mount the app', function(done){20 var blog = express()21 , app = express();2223 blog.get('/blog', function(req, res){24 res.end('blog');25 });26 27 app.use(blog);2829 request(app)30 .get('/blog')31 .expect('blog', done);32 })3334 it('should support mount-points', function(done){35 var blog = express()36 , forum = express()37 , app = express();3839 blog.get('/', function(req, res){40 res.end('blog');41 });4243 forum.get('/', function(req, res){44 res.end('forum');45 });4647 app.use('/blog', blog);48 app.use('/forum', forum);4950 request(app)51 .get('/blog')52 .expect('blog', function(){53 request(app)54 .get('/forum')55 .expect('forum', done);56 });57 })5859 it('should set the child\'s .parent', function(){60 var blog = express()61 , app = express();6263 app.use('/blog', blog);64 blog.parent.should.equal(app);65 })66 })67})