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
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
var express = require('../') , request = require('./support/http');
describe('app', function(){ it('should emit "mount" when mounted', function(done){ var blog = express() , app = express();
blog.on('mount', function(arg){ arg.should.equal(app); done(); });
app.use(blog); })
describe('.use(app)', function(){ it('should mount the app', function(done){ var blog = express() , app = express();
blog.get('/blog', function(req, res){ res.end('blog'); }); app.use(blog);
request(app) .get('/blog') .expect('blog', done); })
it('should support mount-points', function(done){ var blog = express() , forum = express() , app = express();
blog.get('/', function(req, res){ res.end('blog'); });
forum.get('/', function(req, res){ res.end('forum'); });
app.use('/blog', blog); app.use('/forum', forum);
request(app) .get('/blog') .expect('blog', function(){ request(app) .get('/forum') .expect('forum', done); }); })
it('should set the child\'s .parent', function(){ var blog = express() , app = express();
app.use('/blog', blog); blog.parent.should.equal(app); }) })})