Aktueller Stand

This commit is contained in:
2026-01-22 19:05:45 +01:00
parent 85dee61a4d
commit e280e4eadb
1967 changed files with 397327 additions and 74093 deletions

View File

@@ -1,32 +1,32 @@
'use strict'
const { test } = require('tap')
const { test } = require('node:test')
const Fastify = require('..')
test('sync route', async t => {
const app = Fastify()
t.teardown(app.close.bind(app))
app.get('/', () => 'hello world')
const res = await app.inject('/')
t.equal(res.statusCode, 200)
t.equal(res.body, 'hello world')
const fastify = Fastify()
t.after(() => fastify.close())
fastify.get('/', () => 'hello world')
const res = await fastify.inject('/')
t.assert.strictEqual(res.statusCode, 200)
t.assert.strictEqual(res.body, 'hello world')
})
test('sync route return null', async t => {
const app = Fastify()
t.teardown(app.close.bind(app))
app.get('/', () => null)
const res = await app.inject('/')
t.equal(res.statusCode, 200)
t.equal(res.body, 'null')
const fastify = Fastify()
t.after(() => fastify.close())
fastify.get('/', () => null)
const res = await fastify.inject('/')
t.assert.strictEqual(res.statusCode, 200)
t.assert.strictEqual(res.body, 'null')
})
test('sync route, error', async t => {
const app = Fastify()
t.teardown(app.close.bind(app))
app.get('/', () => {
const fastify = Fastify()
t.after(() => fastify.close())
fastify.get('/', () => {
throw new Error('kaboom')
})
const res = await app.inject('/')
t.equal(res.statusCode, 500)
const res = await fastify.inject('/')
t.assert.strictEqual(res.statusCode, 500)
})