app.use.js
This file
Path
test/app.use.js
67 lines · 1.3 KiB · JavaScript
Last changed by
removed "root" settingTj Holowaychukbefore adoption87b991c
History of this fileTake it
adding some mounting testsTj Holowaychukbefore adoptionfcf34e0
lines 1–26why, 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 more mounting testsTj Holowaychukbefore adoption853c270
lines 27–43why, one step back27 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){adding some mounting testsTj Holowaychukbefore adoptionfcf34e0
lines 44–46why, one step back44 res.end('forum');45 });46more mounting testsTj Holowaychukbefore adoption853c270
lines 47–48why, one step back47 app.use('/blog', blog);48 app.use('/forum', forum);adding some mounting testsTj Holowaychukbefore adoptionfcf34e0
lines 49–58why, one step back4950 request(app)51 .get('/blog')52 .expect('blog', function(){53 request(app)54 .get('/forum')55 .expect('forum', done);56 });57 })58.parent testsTj Holowaychukbefore adoption5d593f2
lines 59–66why, one step back59 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 })adding some mounting testsTj Holowaychukbefore adoptionfcf34e0
line 67why, one step back67})