listen.4.test.js — fastify Source File
Architecture documentation for listen.4.test.js, a javascript file in the fastify codebase.
Entity Profile
Relationship Graph
Source Code
'use strict'
const { test, before } = require('node:test')
const dns = require('node:dns').promises
const dnsCb = require('node:dns')
const Fastify = require('../fastify')
const helper = require('./helper')
let localhostForURL
function getUrl (fastify, lookup) {
const { port } = fastify.server.address()
if (lookup.family === 6) {
return `http://[${lookup.address}]:${port}/`
} else {
return `http://${lookup.address}:${port}/`
}
}
before(async function () {
[, localhostForURL] = await helper.getLoopbackHost()
})
test('listen twice on the same port without callback rejects', (t, done) => {
t.plan(1)
const fastify = Fastify()
t.after(() => fastify.close())
fastify.listen({ port: 0 })
.then(() => {
const server2 = Fastify()
t.after(() => server2.close())
server2.listen({ port: fastify.server.address().port })
.catch(err => {
t.assert.ok(err)
done()
})
})
.catch(err => {
t.assert.ifError(err)
})
})
test('listen twice on the same port without callback rejects with (address)', (t, done) => {
t.plan(2)
const fastify = Fastify()
t.after(() => fastify.close())
fastify.listen({ port: 0 })
.then(address => {
const server2 = Fastify()
t.after(() => server2.close())
t.assert.strictEqual(address, `http://${localhostForURL}:${fastify.server.address().port}`)
server2.listen({ port: fastify.server.address().port })
.catch(err => {
t.assert.ok(err)
done()
})
})
.catch(err => {
// ... (109 more lines)
Domain
Subdomains
Functions
Source
Frequently Asked Questions
What does listen.4.test.js do?
listen.4.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 listen.4.test.js?
listen.4.test.js defines 1 function(s): getUrl.
Where is listen.4.test.js in the architecture?
listen.4.test.js is located at test/listen.4.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