Skip to content
Myr

Added app mounting test

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 6e5af3d · Browse files · 1 file+32 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+32 added−0 removed

  • tests:+32 added−0 removed

1 file+32 added−0 removed

modified:test/express.test.js+32 added
219 unmodified lines
220221 assert.response(app,222 { url: '/', method: 'POST', data: 'name=tj', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }},223 { body: '{"name":"tj"}' });224 },225 226 'test mounting': function(assert){227 var app = express.createServer(),228 blog = express.createServer();229 230 app.use('/blog', blog);231 232 app.get('/', function(req, res){233 res.send('main app');234 });235 236 blog.get('/', function(req, res){237 res.send('blog index');238 });239 240 blog.get('/post/:id', function(req, res, params){241 res.send('blog post ' + params.id);242 });243 244 assert.response(app,245 { url: '/' },246 { body: 'main app' });247 assert.response(app,248 { url: '/blog' },249 { body: 'blog index' });250 assert.response(app,251 { url: '/blog/post/12' },252 { body: 'blog post 12' });253 assert.response(blog,254 { url: '/' },255 { body: 'blog index' });256 }257};