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

mkcol.test.js — fastify Source File

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

Entity Profile

Source Code

'use strict'

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

test('can be created - mkcol', t => {
  t.plan(1)
  try {
    fastify.route({
      method: 'MKCOL',
      url: '*',
      handler: function (req, reply) {
        reply.code(201).send()
      }
    })
    t.assert.ok(true)
  } catch (e) {
    t.assert.fail()
  }
})

test('mkcol test', async t => {
  const fastifyServer = await fastify.listen({ port: 0 })
  t.after(() => { fastify.close() })

  await t.test('request - mkcol', async t => {
    t.plan(2)
    const result = await fetch(`${fastifyServer}/test/`, {
      method: 'MKCOL'
    })
    t.assert.ok(result.ok)
    t.assert.strictEqual(result.status, 201)
  })
})

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free