wrap-thenable.test.js — fastify Source File
Architecture documentation for wrap-thenable.test.js, a javascript file in the fastify codebase.
Entity Profile
Source Code
'use strict'
const { test } = require('node:test')
const { kReplyHijacked } = require('../lib/symbols')
const wrapThenable = require('../lib/wrap-thenable')
const Reply = require('../lib/reply')
test('should resolve immediately when reply[kReplyHijacked] is true', async t => {
await new Promise(resolve => {
const reply = {}
reply[kReplyHijacked] = true
const thenable = Promise.resolve()
wrapThenable(thenable, reply)
resolve()
})
})
test('should reject immediately when reply[kReplyHijacked] is true', t => {
t.plan(1)
const reply = new Reply({}, {}, {})
reply[kReplyHijacked] = true
reply.log = {
error: ({ err }) => {
t.assert.strictEqual(err.message, 'Reply sent already')
}
}
const thenable = Promise.reject(new Error('Reply sent already'))
wrapThenable(thenable, reply)
})
Source
Frequently Asked Questions
What does wrap-thenable.test.js do?
wrap-thenable.test.js is a source file in the fastify codebase, written in javascript.
Where is wrap-thenable.test.js in the architecture?
wrap-thenable.test.js is located at test/wrap-thenable.test.js (directory: test).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free