Skip to content

Commit

Permalink
tests: add test for non-error status codes in error objects
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Feb 9, 2017
1 parent 812de98 commit 7043491
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ describe('finalhandler(req, res)', function () {
.expect(400, done)
})

it('should ignore non-error err.statusCode code', function (done) {
request(createServer(createError('created', {
statusCode: 201
})))
.get('/')
.expect(500, done)
})

it('should ignore non-numeric err.statusCode', function (done) {
request(createServer(createError('oops', {
statusCode: 'oh no'
Expand Down Expand Up @@ -149,6 +157,14 @@ describe('finalhandler(req, res)', function () {
.expect(410, done)
})

it('should ignore non-error err.status code', function (done) {
request(createServer(createError('created', {
status: 201
})))
.get('/')
.expect(500, done)
})

it('should ignore non-numeric err.status', function (done) {
request(createServer(createError('oops', {
status: 'oh no'
Expand Down

0 comments on commit 7043491

Please sign in to comment.