Skip to content

Commit

Permalink
build: supertest@3.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Dec 24, 2018
1 parent 8b9a806 commit 3e3df2d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ before_install:
if node_version_lt '0.10'; then npm_use_module 'mocha' '2.5.3'
elif node_version_lt '4.0' ; then npm_use_module 'mocha' '3.5.3'
fi
- |
# Configure supertest for http calls
if node_version_lt '0.10'; then npm_use_module 'supertest' '1.1.0'
elif node_version_lt '4.0' ; then npm_use_module 'supertest' '2.0.0'
fi
# Update Node.js modules
- |
# Prune & rebuild node_modules
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"methods": "1.1.2",
"mocha": "5.2.0",
"safe-buffer": "5.1.2",
"supertest": "1.1.0"
"supertest": "3.3.0"
},
"files": [
"lib/",
Expand Down
10 changes: 7 additions & 3 deletions test/body-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ describe('bodyParser()', function () {
return
}

res.statusCode = req.body.user === 'tobi'
? 201
: 400
res.statusCode = req.headers['x-expect-method'] === req.method
? req.body.user === 'tobi'
? 201
: 400
: 405
res.end()
})
})
Expand All @@ -80,6 +82,8 @@ describe('bodyParser()', function () {
it('should support ' + method.toUpperCase() + ' requests', function (done) {
request(this.server)[method]('/')
.set('Content-Type', 'application/json')
.set('Content-Length', '15')
.set('X-Expect-Method', method.toUpperCase())
.send('{"user":"tobi"}')
.expect(201, done)
})
Expand Down

0 comments on commit 3e3df2d

Please sign in to comment.