| 118 | }) |
| 119 | |
| 120 | const runTests = async (t, fastifyServer) => { |
| 121 | const endpoints = [ |
| 122 | { path: '/yes', expectedBody: { hello: 'world' } }, |
| 123 | { path: '/no', expectedBody: { hello: 'world' } } |
| 124 | ] |
| 125 | |
| 126 | for (const { path, expectedBody } of endpoints) { |
| 127 | const result = await fetch(`${fastifyServer}${path}`) |
| 128 | t.assert.ok(result.ok) |
| 129 | t.assert.strictEqual(result.status, 200) |
| 130 | const body = await result.text() |
| 131 | t.assert.strictEqual(result.headers.get('content-length'), '' + body.length) |
| 132 | t.assert.deepStrictEqual(JSON.parse(body), expectedBody) |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | test('decorateReply inside register', async (t) => { |
| 137 | t.plan(10) |