mirror of
https://github.com/zebrajr/express.git
synced 2025-12-06 12:19:51 +01:00
adding some mounting tests
This commit is contained in:
parent
b6611c8a3b
commit
fcf34e0587
46
test/app.use.js
Normal file
46
test/app.use.js
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
|
||||
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()
|
||||
, forum = express()
|
||||
, app = express();
|
||||
|
||||
blog.get('/blog', function(req, res){
|
||||
res.end('blog');
|
||||
});
|
||||
|
||||
forum.get('/forum', function(req, res){
|
||||
res.end('forum');
|
||||
});
|
||||
|
||||
app.use(blog);
|
||||
app.use(forum);
|
||||
|
||||
request(app)
|
||||
.get('/blog')
|
||||
.expect('blog', function(){
|
||||
request(app)
|
||||
.get('/forum')
|
||||
.expect('forum', done);
|
||||
});
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
|
||||
var express = require('../');
|
||||
|
||||
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);
|
||||
})
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user