Skip to content
Myr

more tests

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 1322d5a · Browse files · 1 file+36 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+36 added−0 removed

  • tests:+36 added−0 removed

1 file+36 added−0 removed

modified:test/app.router.js+36 added
377 unmodified lines
378 .get('/user/tj/edit')379 .expect('editing tj', done);380 })381 })382 383 describe('.:name', function(){384 it('should denote a format', function(done){385 var app = express();386387 app.get('/:name.:format', function(req, res){388 res.end(req.params.name + ' as ' + req.params.format);389 });390391 request(app)392 .get('/foo.json')393 .expect('foo as json', function(){394 request(app)395 .get('/foo')396 .expect(404, done);397 });398 })399 })400 401 describe('.:name?', function(){402 it('should denote an optional format', function(done){403 var app = express();404405 app.get('/:name.:format?', function(req, res){406 res.end(req.params.name + ' as ' + (req.params.format || 'html'));407 });408409 request(app)410 .get('/foo')411 .expect('foo as html', function(){412 request(app)413 .get('/foo.json')414 .expect('foo as json', done);415 });416 })417 })418})