helper() — fastify Function Reference
Architecture documentation for the helper() function in reply-error.test.js from the fastify codebase.
Entity Profile
Dependency Diagram
graph TD 35f5eed8_d37a_75cd_49c8_083c97245c32["helper()"] 57c12fa4_7e87_eb80_2b36_d0f27c8d80bf["reply-error.test.js"] 35f5eed8_d37a_75cd_49c8_083c97245c32 -->|defined in| 57c12fa4_7e87_eb80_2b36_d0f27c8d80bf style 35f5eed8_d37a_75cd_49c8_083c97245c32 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
test/reply-error.test.js lines 16–47
function helper (code) {
test('Reply error handling - code: ' + code, (t, testDone) => {
t.plan(4)
const fastify = Fastify()
t.after(() => fastify.close())
const err = new Error('winter is coming')
fastify.get('/', (req, reply) => {
reply
.code(Number(code))
.send(err)
})
fastify.inject({
method: 'GET',
url: '/'
}, (error, res) => {
t.assert.ifError(error)
t.assert.strictEqual(res.statusCode, Number(code))
t.assert.strictEqual(res.headers['content-type'], 'application/json; charset=utf-8')
t.assert.deepStrictEqual(
{
error: statusCodes[code],
message: err.message,
statusCode: Number(code)
},
JSON.parse(res.payload)
)
testDone()
})
})
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does helper() do?
helper() is a function in the fastify codebase, defined in test/reply-error.test.js.
Where is helper() defined?
helper() is defined in test/reply-error.test.js at line 16.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free