Chapter 11: update example microservice

This commit is contained in:
Beth Griggs
2020-11-15 01:11:41 +00:00
parent 791aac76d7
commit cb0e52e541
11 changed files with 146 additions and 9 deletions
@@ -0,0 +1,26 @@
'use strict'
const { test } = require('tap')
const Fastify = require('fastify')
const Support = require('../../plugins/support')
test('support works standalone', async (t) => {
const fastify = Fastify()
fastify.register(Support)
await fastify.ready()
t.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)
// t.equal(fastify.someSupport(), 'hugs')
// })
// })