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

async-await.test.js — fastify Source File

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

Entity Profile

Source Code

'use strict'

const { test } = require('node:test')
const Fastify = require('..')
const split = require('split2')
const pino = require('pino')
const { sleep } = require('./helper')
const statusCodes = require('node:http').STATUS_CODES

const opts = {
  schema: {
    response: {
      '2xx': {
        type: 'object',
        properties: {
          hello: {
            type: 'string'
          }
        }
      }
    }
  }
}

const optsWithHostnameAndPort = {
  schema: {
    response: {
      '2xx': {
        type: 'object',
        properties: {
          hello: {
            type: 'string'
          },
          hostname: {
            type: 'string'
          },
          port: {
            type: 'string'
          }
        }
      }
    }
  }
}
test('async await', async t => {
  t.plan(15)
  const fastify = Fastify()
  try {
    fastify.get('/', opts, async function awaitMyFunc (req, reply) {
      await sleep(200)
      return { hello: 'world' }
    })
    t.assert.ok(true)
  } catch (e) {
    t.assert.fail()
  }

  try {
    fastify.get('/no-await', opts, async function (req, reply) {
      return { hello: 'world' }
// ... (646 more lines)

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free