/
erioxis
/
web-nodejs
Обзор
Документация
Войти
/
erioxis
/
web-nodejs
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
backend/node_modules/fastify/test/diagnostics-channel/init.test.js
50 строк
1 KB
erioxis
lab11fix
15 дек 2025, 23:21
15 дек 2025, 23:21
70dc7ba
Код
Авторство
О чём код?
'use strict' const { test } = require('node:test') const proxyquire = require('proxyquire') test('diagnostics_channel when present and subscribers', t => { t.plan(3) let fastifyInHook const diagnostics = { channel (name) { t.assert.strictEqual(name, 'fastify.initialization') return { hasSubscribers: true, publish (event) { t.assert.ok(event.fastify) fastifyInHook = event.fastify } } }, '@noCallThru': true } const fastify = proxyquire('../../fastify', { 'node:diagnostics_channel': diagnostics })() t.assert.strictEqual(fastifyInHook, fastify) }) test('diagnostics_channel when present and no subscribers', t => { t.plan(1) const diagnostics = { channel (name) { t.assert.strictEqual(name, 'fastify.initialization') return { hasSubscribers: false, publish () { t.assert.fail('publish should not be called') } } }, '@noCallThru': true } proxyquire('../../fastify', { 'node:diagnostics_channel': diagnostics })() })