context-config.test.js — fastify Source File
Architecture documentation for context-config.test.js, a javascript file in the fastify codebase.
Entity Profile
Relationship Graph
Source Code
'use strict'
const { test } = require('node:test')
const { kRouteContext } = require('../lib/symbols')
const Fastify = require('..')
const schema = {
schema: { },
config: {
value1: 'foo',
value2: true
}
}
function handler (req, reply) {
reply.send(reply[kRouteContext].config)
}
test('config', async t => {
t.plan(6)
const fastify = Fastify()
fastify.get('/get', {
schema: schema.schema,
config: Object.assign({}, schema.config)
}, handler)
fastify.route({
method: 'GET',
url: '/route',
schema: schema.schema,
handler,
config: Object.assign({}, schema.config)
})
fastify.route({
method: 'GET',
url: '/no-config',
schema: schema.schema,
handler
})
let response = await fastify.inject({
method: 'GET',
url: '/route'
})
t.assert.strictEqual(response.statusCode, 200)
t.assert.deepStrictEqual(response.json(), Object.assign({ url: '/route', method: 'GET' }, schema.config))
response = await fastify.inject({
method: 'GET',
url: '/route'
})
t.assert.strictEqual(response.statusCode, 200)
t.assert.deepStrictEqual(response.json(), Object.assign({ url: '/route', method: 'GET' }, schema.config))
response = await fastify.inject({
// ... (105 more lines)
Domain
Subdomains
Functions
Source
Frequently Asked Questions
What does context-config.test.js do?
context-config.test.js is a source file in the fastify codebase, written in javascript. It belongs to the CoreKernel domain, InstanceFactory subdomain.
What functions are defined in context-config.test.js?
context-config.test.js defines 1 function(s): handler.
Where is context-config.test.js in the architecture?
context-config.test.js is located at test/context-config.test.js (domain: CoreKernel, subdomain: InstanceFactory, directory: test).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free