Skip to content

Commit

Permalink
improvement: Fix grammar in error an message
Browse files Browse the repository at this point in the history
  • Loading branch information
nwoltman committed Jun 23, 2019
1 parent 92208f4 commit b04a8ea
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion medley.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function medley(options) {
options = options || {}

if (options.queryParser !== undefined && typeof options.queryParser !== 'function') {
throw new TypeError(`'queryParser' option must be an function. Got a '${typeof options.queryParser}'`)
throw new TypeError(`'queryParser' option must be a function. Got value of type '${typeof options.queryParser}'`)
}

const router = findMyWay({
Expand Down
11 changes: 8 additions & 3 deletions test/queryParser-option.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@ const medley = require('..')
const request = require('./utils/request')

t.test('queryParser', (t) => {
t.plan(6)
t.plan(7)

t.throws(
() => medley({queryParser: true}),
new TypeError("'queryParser' option must be an function. Got a 'boolean'")
new TypeError("'queryParser' option must be a function. Got value of type 'boolean'")
)

t.throws(
() => medley({queryParser: 'simple'}),
new TypeError("'queryParser' option must be an function. Got a 'string'")
new TypeError("'queryParser' option must be a function. Got value of type 'string'")
)

t.throws(
() => medley({queryParser: []}),
new TypeError("'queryParser' option must be a function. Got value of type 'object'")
)

const app = medley({
Expand Down

0 comments on commit b04a8ea

Please sign in to comment.