Home / File/ server.test.js — fastify Source File

server.test.js — fastify Source File

Architecture documentation for server.test.js, a javascript file in the fastify codebase.

Entity Profile

Relationship Graph

Source Code

'use strict'

const dns = require('node:dns')
const { networkInterfaces } = require('node:os')
const { test } = require('node:test')
const Fastify = require('..')
const undici = require('undici')
const proxyquire = require('proxyquire')

const isIPv6Missing = !Object.values(networkInterfaces()).flat().some(({ family }) => family === 'IPv6')

test('listen should accept null port', async t => {
  const fastify = Fastify()
  t.after(() => fastify.close())

  await t.assert.doesNotReject(
    fastify.listen({ port: null })
  )
})

test('listen should accept undefined port', async t => {
  const fastify = Fastify()
  t.after(() => fastify.close())

  await t.assert.doesNotReject(
    fastify.listen({ port: undefined })
  )
})

test('listen should accept stringified number port', async t => {
  const fastify = Fastify()
  t.after(() => fastify.close())

  await t.assert.doesNotReject(
    fastify.listen({ port: '1234' })
  )
})

test('listen should accept log text resolution function', async t => {
  const fastify = Fastify()
  t.after(() => fastify.close())

  await t.assert.doesNotReject(
    fastify.listen({
      host: '127.0.0.1',
      port: '1234',
      listenTextResolver: (address) => {
        t.assert.strictEqual(address, 'http://127.0.0.1:1234')
        return 'hardcoded text'
      }
    })
  )
})

test('listen should reject string port', async (t) => {
  const fastify = Fastify()
  t.after(() => fastify.close())

  try {
    await fastify.listen({ port: 'hello-world' })
// ... (288 more lines)

Domain

Subdomains

Functions

Frequently Asked Questions

What does server.test.js do?
server.test.js is a source file in the fastify codebase, written in javascript. It belongs to the CoreKernel domain, LifecycleManager subdomain.
What functions are defined in server.test.js?
server.test.js defines 1 function(s): isIPv6Missing.
Where is server.test.js in the architecture?
server.test.js is located at test/server.test.js (domain: CoreKernel, subdomain: LifecycleManager, directory: test).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free