Skip to content

Commit

Permalink
Fix tests to support fastify v2
Browse files Browse the repository at this point in the history
  • Loading branch information
cemremengu committed Nov 28, 2018
1 parent d909018 commit afe23d5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion formbody.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ function formBodyPlugin (fastify, options, next) {
}

module.exports = fp(formBodyPlugin, {
fastify: '^1.0.0',
fastify: '^2.0.0',
name: 'fastify-formbody'
})
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"description": "A module for Fastify to parse x-www-form-urlencoded bodies",
"main": "formbody.js",
"scripts": {
"test": "tap 'test/**/*.test.js'",
"test-ci": "tap 'test/**/*.test.js' --coverage-report=html",
"test": "tap test/**/*.test.js",
"test-ci": "tap test/**/*.test.js --coverage-report=html",
"lint": "standard | snazzy",
"lint-ci": "standard",
"codecov": "codecov"
Expand All @@ -30,7 +30,7 @@
"homepage": "https://github.com/fastify/fastify-formbody#readme",
"devDependencies": {
"codecov": "^3.1.0",
"fastify": "^1.0.0",
"fastify": "2.0.0-rc.0",
"pre-commit": "^1.2.2",
"request": "^2.88.0",
"snazzy": "^8.0.0",
Expand Down
8 changes: 4 additions & 4 deletions test/integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ test('cannot exceed body limit', (t) => {
req({ uri: '/limited', form: { foo: payload } }, (err, response, body) => {
t.error(err)
t.strictEqual(response.statusCode, 413)
t.is(JSON.parse(body).message, 'Request body is too large')
t.is(JSON.parse(body).message, 'FST_ERR_CTP_BODY_TOO_LARGE: Request body is too large')
})
})
})
Expand Down Expand Up @@ -100,7 +100,7 @@ test('cannot exceed body limit when Content-Length is not available', (t) => {
req({ uri: '/limited', body: payload }, (err, response, body) => {
t.error(err)
t.strictEqual(response.statusCode, 413)
t.is(JSON.parse(body).message, 'Request body is too large')
t.is(JSON.parse(body).message, 'FST_ERR_CTP_BODY_TOO_LARGE: Request body is too large')
})
})
})
Expand Down Expand Up @@ -128,7 +128,7 @@ test('cannot exceed body limit set on Fastify instance', (t) => {
req({ uri: '/limited', form: { foo: payload } }, (err, response, body) => {
t.error(err)
t.strictEqual(response.statusCode, 413)
t.is(JSON.parse(body).message, 'Request body is too large')
t.is(JSON.parse(body).message, 'FST_ERR_CTP_BODY_TOO_LARGE: Request body is too large')
})
})
})
Expand Down Expand Up @@ -156,7 +156,7 @@ test('plugin bodyLimit should overwrite Fastify instance bodyLimit', (t) => {
req({ uri: '/limited', form: { foo: payload } }, (err, response, body) => {
t.error(err)
t.strictEqual(response.statusCode, 413)
t.is(JSON.parse(body).message, 'Request body is too large')
t.is(JSON.parse(body).message, 'FST_ERR_CTP_BODY_TOO_LARGE: Request body is too large')
})
})
})

0 comments on commit afe23d5

Please sign in to comment.