plugin.1.test.js — fastify Source File
Architecture documentation for plugin.1.test.js, a javascript file in the fastify codebase.
Entity Profile
Source Code
'use strict'
const t = require('node:test')
const test = t.test
const Fastify = require('../fastify')
const fp = require('fastify-plugin')
test('require a plugin', (t, testDone) => {
t.plan(1)
const fastify = Fastify()
fastify.register(require('./plugin.helper'))
fastify.ready(() => {
t.assert.ok(fastify.test)
testDone()
})
})
test('plugin metadata - ignore prefix', (t, testDone) => {
t.plan(2)
const fastify = Fastify()
plugin[Symbol.for('skip-override')] = true
fastify.register(plugin, { prefix: 'foo' })
fastify.inject({
method: 'GET',
url: '/'
}, function (err, res) {
t.assert.ifError(err)
t.assert.strictEqual(res.payload, 'hello')
testDone()
})
function plugin (instance, opts, done) {
instance.get('/', function (request, reply) {
reply.send('hello')
})
done()
}
})
test('plugin metadata - naming plugins', async t => {
t.plan(2)
const fastify = Fastify()
fastify.register(require('./plugin.name.display'))
fastify.register(function (fastify, opts, done) {
// one line
t.assert.strictEqual(fastify.pluginName, 'function (fastify, opts, done) { -- // one line')
done()
})
fastify.register(function fooBar (fastify, opts, done) {
t.assert.strictEqual(fastify.pluginName, 'fooBar')
done()
})
await fastify.ready()
})
test('fastify.register with fastify-plugin should not encapsulate his code', async t => {
// ... (171 more lines)
Source
Frequently Asked Questions
What does plugin.1.test.js do?
plugin.1.test.js is a source file in the fastify codebase, written in javascript.
Where is plugin.1.test.js in the architecture?
plugin.1.test.js is located at test/plugin.1.test.js (directory: test).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free