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

copy.test.js — fastify Source File

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

Entity Profile

Source Code

'use strict'

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

test('can be created - copy', async t => {
  t.plan(3)

  t.after(() => fastify.close())

  try {
    fastify.route({
      method: 'COPY',
      url: '*',
      handler: function (req, reply) {
        reply.code(204).send()
      }
    })
    t.assert.ok(true)
  } catch (e) {
    t.assert.fail()
  }

  const fastifyServer = await fastify.listen({ port: 0 })

  const result = await fetch(`${fastifyServer}/test.txt`, {
    method: 'COPY',
    headers: {
      Destination: '/test2.txt'
    }
  })
  t.assert.ok(result.ok)
  t.assert.strictEqual(result.status, 204)
})

Frequently Asked Questions

What does copy.test.js do?
copy.test.js is a source file in the fastify codebase, written in javascript.
Where is copy.test.js in the architecture?
copy.test.js is located at test/http-methods/copy.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