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,10 +1,10 @@
'use strict'
const t = require('tap')
const { test } = require('node:test')
const fastify = require('fastify')
const FjsCompiler = require('../index')
const echo = async (req, reply) => { return req.body }
const echo = async (req) => { return req.body }
const sampleSchema = Object.freeze({
$id: 'example1',
@@ -27,16 +27,16 @@ const externalSchemas2 = Object.freeze({
const fastifyFjsOptionsDefault = Object.freeze({})
t.test('basic usage', t => {
test('basic usage', t => {
t.plan(1)
const factory = FjsCompiler()
const compiler = factory(externalSchemas1, fastifyFjsOptionsDefault)
const serializeFunc = compiler({ schema: sampleSchema })
const result = serializeFunc({ name: 'hello' })
t.equal(result, '{"name":"hello"}')
t.assert.equal(result, '{"name":"hello"}')
})
t.test('fastify integration', async t => {
test('fastify integration', async t => {
const factory = FjsCompiler()
const app = fastify({
@@ -73,6 +73,6 @@ t.test('fastify integration', async t => {
}
})
t.equal(res.statusCode, 200)
t.same(res.json(), { name: 'serialize me' })
t.assert.equal(res.statusCode, 200)
t.assert.deepStrictEqual(res.json(), { name: 'serialize me' })
})