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

decorator.test.js — fastify Source File

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

Entity Profile

Relationship Graph

Source Code

'use strict'

const { test, describe } = require('node:test')
const Fastify = require('..')
const fp = require('fastify-plugin')
const symbols = require('../lib/symbols.js')

test('server methods should exist', t => {
  t.plan(2)
  const fastify = Fastify()
  t.assert.ok(fastify.decorate)
  t.assert.ok(fastify.hasDecorator)
})

test('should check if the given decoration already exist when null', (t, done) => {
  t.plan(1)
  const fastify = Fastify()
  fastify.decorate('null', null)
  fastify.ready(() => {
    t.assert.ok(fastify.hasDecorator('null'))
    done()
  })
})

test('server methods should be encapsulated via .register', (t, done) => {
  t.plan(2)
  const fastify = Fastify()

  fastify.register((instance, opts, done) => {
    instance.decorate('test', () => {})
    t.assert.ok(instance.test)
    done()
  })

  fastify.ready(() => {
    t.assert.strictEqual(fastify.test, undefined)
    done()
  })
})

test('hasServerMethod should check if the given method already exist', (t, done) => {
  t.plan(2)
  const fastify = Fastify()

  fastify.register((instance, opts, done) => {
    instance.decorate('test', () => {})
    t.assert.ok(instance.hasDecorator('test'))
    done()
  })

  fastify.ready(() => {
    t.assert.strictEqual(fastify.hasDecorator('test'), false)
    done()
  })
})

test('decorate should throw if a declared dependency is not present', (t, done) => {
  t.plan(3)
  const fastify = Fastify()

// ... (1271 more lines)

Domain

Subdomains

Functions

Frequently Asked Questions

What does decorator.test.js do?
decorator.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 decorator.test.js?
decorator.test.js defines 1 function(s): runTests.
Where is decorator.test.js in the architecture?
decorator.test.js is located at test/decorator.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