Skip to content

Commit

Permalink
chore: update tests and examples for fastify v4
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs committed Aug 4, 2022
1 parent 14663af commit a86a644
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Add accepts parser to fastify
const fastify = require('fastify')
const Boom = require('boom')

fastify.register(require('@fastify/accepts'))
await fastify.register(require('@fastify/accepts'))

fastify.post('/', function (req, reply) {
const accept = req.accepts() // Accepts object
Expand Down
2 changes: 1 addition & 1 deletion index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import accepts from "."

const app = fastify()

app.register(accepts)
await app.register(accepts)

app.get("/", (request, reply) => {
request.accepts()
Expand Down
5 changes: 2 additions & 3 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ test('accept header', t => {
})
})

fastify.listen(0, function () {
fastify.listen({ port: 0 }, function () {
const BASE_URL = `http://localhost:${fastify.server.address().port}`

testCases.forEach(function (testCase) {
Expand All @@ -139,8 +139,7 @@ test('accept header', t => {

test('no reply decorator', async function (t) {
const fastify = Fastify()
fastify.register(plugin, { decorateReply: false })
await fastify.ready()
await fastify.register(plugin, { decorateReply: false }).ready()

const methodNames = [
'Charset', 'Charsets',
Expand Down

0 comments on commit a86a644

Please sign in to comment.