/
erioxis
/
web-nodejs
Обзор
Документация
Войти
/
erioxis
/
web-nodejs
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
backend/node_modules/fastify/test/internals/context.test.js
31 строка
760 B
erioxis
lab11fix
15 дек 2025, 23:21
15 дек 2025, 23:21
70dc7ba
Код
Авторство
О чём код?
'use strict' const { test } = require('node:test') const { kRouteContext } = require('../../lib/symbols') const Context = require('../../lib/context') const Fastify = require('../..') test('context', async context => { context.plan(1) await context.test('Should not contain undefined as key prop', async t => { t.plan(4) const app = Fastify() app.get('/', (req, reply) => { t.assert.ok(req[kRouteContext] instanceof Context) t.assert.ok(reply[kRouteContext] instanceof Context) t.assert.ok(!('undefined' in reply[kRouteContext])) t.assert.ok(!('undefined' in req[kRouteContext])) reply.send('hello world!') }) try { await app.inject('/') } catch (e) { t.assert.fail(e) } }) })