Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions test/serialization.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,3 +241,39 @@ t.test('fastify integration and cached serializer', async t => {
})
}
})

t.test('fastify integration within JTD serializer and custom options', async t => {
const factorySerializer = AjvCompiler({ jtdSerializer: true })

const app = fastify({
jsonShorthand: false,
serializerOpts: {
allErrors: true,
logger: 'wrong-value'
},
schemaController: {
compilersFactory: {
buildSerializer: factorySerializer
}
}
})

app.post('/', {
schema: {
response: {
200: {
properties: {
test: { type: 'boolean' }
}
}
}
}
}, async () => { })

try {
await app.ready()
t.fail('should throw')
} catch (error) {
t.equal(error.message, 'logger must implement log, warn and error methods', 'the wrong setting is forwarded to ajv/jtd')
}
})