deps: supertest@1.0.1
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parent 96b4a76 · Browse files · 4 files·+17 added−9 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+17 added−9 removed
- tests:+6 added−6 removed
- other:+11 added−3 removed
Provenance
- Commit
7df8fa3- Tree
7fc9d9c- Author
Douglas Christopher Wilson <doug@somethingdoug.com>- Committer
Douglas Christopher Wilson <doug@somethingdoug.com>- Parent
96b4a76
4 files changed+17 added−9 removed
modified:examples/params/app.js+10 added-2 removed
14 unmodified lines15161718192021222324252627282930312432333435363 unmodified lines4041424336444546474831 unmodified lines14 unmodified lines , { name: 'jane' } , { name: 'bandit' }];
// Create HTTP error
function createError(status, message) { var err = new Error(message); err.status = status; return err;}
// Convert :to and :from to integers
app.param(['to', 'from'], function(req, res, next, num, name){ req.params[name] = parseInt(num, 10); if( isNaN(req.params[name]) ){ next(new Error('failed to parseInt '+num)); next(createError(400, 'failed to parseInt '+num)); } else { next(); }});3 unmodified linesapp.param('user', function(req, res, next, id){ if (req.user = users[id]) { next(); } else { next(new Error('failed to find user')); next(createError(404, 'failed to find user')); }});
/**31 unmodified linesmodified:test/acceptance/mvc.js+2 added-2 removed
33 unmodified lines34 request(app)35 .put('/pet/3')36 .set('Content-Type', 'application/x-www-form-urlencoded')37 .send({ pet: { name: 'Boots' } })38- .end(function(err, res){38+ .expect(302, function (err, res) {39 if (err) return done(err);40 request(app)41 .get('/pet/3/edit')42 .expect(200, /Boots/, done)54 unmodified lines97 request(app)98 .put('/user/1')99 .set('Content-Type', 'application/x-www-form-urlencoded')100 .send({ user: { name: 'Tobo' }})101- .end(function(err, res){101+ .expect(302, function (err, res) {102 if (err) return done(err);103 request(app)104 .get('/user/1/edit')105 .expect(200, /Tobo/, done)20 unmodified linesmodified:test/acceptance/params.js+4 added-4 removed
19 unmodified lines2021222324252425262728296 unmodified lines363738394041404142434419 unmodified lines
describe('GET /user/9', function(){ it('should fail to find user', function(done){ request(app) .get('/user/9') .expect(/failed to find user/,done) .get('/user/9') .expect(404, /failed to find user/, done) }) })
describe('GET /users/0-2', function(){6 unmodified lines
describe('GET /users/foo-bar', function(){ it('should fail integer parsing', function(done){ request(app) .get('/users/foo-bar') .expect(/failed to parseInt foo/,done) .get('/users/foo-bar') .expect(400, /failed to parseInt foo/, done) }) })})modified:package.json+1 added-1 removed
53 unmodified lines54 "istanbul": "0.3.9",55 "marked": "0.3.3",56 "mocha": "2.2.5",57 "should": "~5.2.0",58- "supertest": "~0.15.0"58+ "supertest": "1.0.1"59 },60 "engines": {61 "node": ">= 0.8.0"62 },18 unmodified lines