Home / File/ async-dispose.test.js — fastify Source File

async-dispose.test.js — fastify Source File

Architecture documentation for async-dispose.test.js, a javascript file in the fastify codebase.

Entity Profile

Source Code

'use strict'

const { test } = require('node:test')
const Fastify = require('../fastify')

// asyncDispose doesn't exist in node <= 16
test('async dispose should close fastify', { skip: !('asyncDispose' in Symbol) }, async t => {
  t.plan(2)

  const fastify = Fastify()

  await fastify.listen({ port: 0 })

  t.assert.strictEqual(fastify.server.listening, true)

  // the same as syntax sugar for
  // await using app = fastify()
  await fastify[Symbol.asyncDispose]()
  t.assert.strictEqual(fastify.server.listening, false)
})

Frequently Asked Questions

What does async-dispose.test.js do?
async-dispose.test.js is a source file in the fastify codebase, written in javascript.
Where is async-dispose.test.js in the architecture?
async-dispose.test.js is located at test/async-dispose.test.js (directory: test).

Analyze Your Own Codebase

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

Try Supermodel Free