support.test.js 594 B

1234567891011121314151617181920212223242526
  1. 'use strict'
  2. const { test } = require('tap')
  3. const Fastify = require('fastify')
  4. const Support = require('../../plugins/support')
  5. test('support works standalone', async (t) => {
  6. const fastify = Fastify()
  7. fastify.register(Support)
  8. await fastify.ready()
  9. t.equal(fastify.someSupport(), 'hugs')
  10. })
  11. // You can also use plugin with opts in fastify v2
  12. //
  13. // test('support works standalone', (t) => {
  14. // t.plan(2)
  15. // const fastify = Fastify()
  16. // fastify.register(Support)
  17. //
  18. // fastify.ready((err) => {
  19. // t.error(err)
  20. // t.equal(fastify.someSupport(), 'hugs')
  21. // })
  22. // })