29 lines
649 B
JavaScript
29 lines
649 B
JavaScript
'use strict'
|
|
|
|
const { test } = require('node:test')
|
|
const assert = require('node:assert')
|
|
|
|
const Fastify = require('fastify')
|
|
const Support = require('../../plugins/support')
|
|
|
|
test('support works standalone', async (t) => {
|
|
const fastify = Fastify()
|
|
fastify.register(Support)
|
|
|
|
await fastify.ready()
|
|
assert.equal(fastify.someSupport(), 'hugs')
|
|
})
|
|
|
|
// You can also use plugin with opts in fastify v2
|
|
//
|
|
// test('support works standalone', (t) => {
|
|
// t.plan(2)
|
|
// const fastify = Fastify()
|
|
// fastify.register(Support)
|
|
//
|
|
// fastify.ready((err) => {
|
|
// t.error(err)
|
|
// assert.equal(fastify.someSupport(), 'hugs')
|
|
// })
|
|
// })
|