First commit

This commit is contained in:
2026-01-12 13:12:46 +01:00
parent b2d9501f6d
commit a1fbd8acf5
4413 changed files with 1245183 additions and 0 deletions

38
node_modules/fastify/test/middleware.test.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
'use strict'
const { test } = require('tap')
const Fastify = require('..')
const {
FST_ERR_DEC_ALREADY_PRESENT
} = require('../lib/errors')
test('Should be able to override the default use API', t => {
t.plan(1)
const fastify = Fastify()
fastify.decorate('use', () => true)
t.equal(fastify.use(), true)
})
test('Cannot decorate use twice', t => {
t.plan(1)
const fastify = Fastify()
fastify.decorate('use', () => true)
try {
fastify.decorate('use', () => true)
} catch (err) {
t.ok(err instanceof FST_ERR_DEC_ALREADY_PRESENT)
}
})
test('Encapsulation works', t => {
t.plan(1)
const fastify = Fastify()
fastify.register((instance, opts, done) => {
instance.decorate('use', () => true)
t.equal(instance.use(), true)
done()
})
fastify.ready()
})