Projektstart

This commit is contained in:
2026-01-22 15:49:12 +01:00
parent 7212eb6f7a
commit 57e5f652f8
10637 changed files with 2598792 additions and 64 deletions

View File

@@ -0,0 +1,61 @@
'use strict'
const t = require('tap')
const test = t.test
const proxyquire = require('proxyquire')
test('diagnostics_channel when present and subscribers', t => {
t.plan(3)
let fastifyInHook
const dc = {
channel (name) {
t.equal(name, 'fastify.initialization')
return {
hasSubscribers: true,
publish (event) {
t.ok(event.fastify)
fastifyInHook = event.fastify
}
}
},
'@noCallThru': true
}
const fastify = proxyquire('../fastify', {
'node:diagnostics_channel': dc
})()
t.equal(fastifyInHook, fastify)
})
test('diagnostics_channel when present and no subscribers', t => {
t.plan(1)
const dc = {
channel (name) {
t.equal(name, 'fastify.initialization')
return {
hasSubscribers: false,
publish () {
t.fail('publish should not be called')
}
}
},
'@noCallThru': true
}
proxyquire('../fastify', {
'node:diagnostics_channel': dc
})()
})
test('diagnostics_channel when not present', t => {
t.plan(1)
t.doesNotThrow(() => {
proxyquire('../fastify', {
'node:diagnostics_channel': null
})()
})
})