page cw
This commit is contained in:
28
test/routes/example.test.js
Normal file
28
test/routes/example.test.js
Normal file
@@ -0,0 +1,28 @@
|
||||
'use strict'
|
||||
|
||||
const { test } = require('node:test')
|
||||
const assert = require('node:assert')
|
||||
const { build } = require('../helper')
|
||||
|
||||
test('example is loaded', async (t) => {
|
||||
const app = await build(t)
|
||||
|
||||
const res = await app.inject({
|
||||
url: '/example'
|
||||
})
|
||||
assert.equal(res.payload, 'this is an example')
|
||||
})
|
||||
|
||||
// inject callback style:
|
||||
//
|
||||
// test('example is loaded', (t) => {
|
||||
// t.plan(2)
|
||||
// const app = await build(t)
|
||||
//
|
||||
// app.inject({
|
||||
// url: '/example'
|
||||
// }, (err, res) => {
|
||||
// t.error(err)
|
||||
// assert.equal(res.payload, 'this is an example')
|
||||
// })
|
||||
// })
|
||||
28
test/routes/root.test.js
Normal file
28
test/routes/root.test.js
Normal file
@@ -0,0 +1,28 @@
|
||||
'use strict'
|
||||
|
||||
const { test } = require('node:test')
|
||||
const assert = require('node:assert')
|
||||
const { build } = require('../helper')
|
||||
|
||||
test('default root route', async (t) => {
|
||||
const app = await build(t)
|
||||
|
||||
const res = await app.inject({
|
||||
url: '/'
|
||||
})
|
||||
assert.deepStrictEqual(JSON.parse(res.payload), { root: true })
|
||||
})
|
||||
|
||||
// inject callback style:
|
||||
//
|
||||
// test('default root route', (t) => {
|
||||
// t.plan(2)
|
||||
// const app = await build(t)
|
||||
//
|
||||
// app.inject({
|
||||
// url: '/'
|
||||
// }, (err, res) => {
|
||||
// t.error(err)
|
||||
// assert.deepStrictEqual(JSON.parse(res.payload), { root: true })
|
||||
// })
|
||||
// })
|
||||
Reference in New Issue
Block a user