example.test.js 530 B

123456789101112131415161718192021222324252627
  1. 'use strict'
  2. const { test } = require('tap')
  3. const { build } = require('../helper')
  4. test('example is loaded', async (t) => {
  5. const app = await build(t)
  6. const res = await app.inject({
  7. url: '/example'
  8. })
  9. t.equal(res.payload, 'this is an example')
  10. })
  11. // inject callback style:
  12. //
  13. // test('example is loaded', (t) => {
  14. // t.plan(2)
  15. // const app = await build(t)
  16. //
  17. // app.inject({
  18. // url: '/example'
  19. // }, (err, res) => {
  20. // t.error(err)
  21. // t.equal(res.payload, 'this is an example')
  22. // })
  23. // })