Skip to content

Commit 67741fc

Browse files
author
Nicolas Balduzzi
committed
fastify onRoute hook moved before plugin registration
1 parent b974ab0 commit 67741fc

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

test/static.test.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -726,12 +726,13 @@ t.test('register /static/ with schemaHide true', t => {
726726
}
727727

728728
const fastify = Fastify()
729-
fastify.register(fastifyStatic, pluginOptions)
730729

731730
fastify.addHook('onRoute', function (routeOptions) {
732731
t.deepEqual(routeOptions.schema, { hide: true })
733732
})
734733

734+
fastify.register(fastifyStatic, pluginOptions)
735+
735736
t.tearDown(fastify.close.bind(fastify))
736737

737738
fastify.listen(0, err => {
@@ -765,12 +766,13 @@ t.test('register /static/ with schemaHide false', t => {
765766
}
766767

767768
const fastify = Fastify()
768-
fastify.register(fastifyStatic, pluginOptions)
769769

770770
fastify.addHook('onRoute', function (routeOptions) {
771771
t.deepEqual(routeOptions.schema, { hide: false })
772772
})
773773

774+
fastify.register(fastifyStatic, pluginOptions)
775+
774776
t.tearDown(fastify.close.bind(fastify))
775777

776778
fastify.listen(0, err => {
@@ -803,12 +805,13 @@ t.test('register /static/ without schemaHide', t => {
803805
}
804806

805807
const fastify = Fastify()
806-
fastify.register(fastifyStatic, pluginOptions)
807808

808809
fastify.addHook('onRoute', function (routeOptions) {
809810
t.deepEqual(routeOptions.schema, { hide: true })
810811
})
811812

813+
fastify.register(fastifyStatic, pluginOptions)
814+
812815
t.tearDown(fastify.close.bind(fastify))
813816

814817
fastify.listen(0, err => {

0 commit comments

Comments
 (0)