nullable-validation.test.js — fastify Source File
Architecture documentation for nullable-validation.test.js, a javascript file in the fastify codebase.
Entity Profile
Source Code
'use strict'
const { test } = require('node:test')
const Fastify = require('..')
test('nullable string', (t, done) => {
t.plan(3)
const fastify = Fastify()
fastify.route({
method: 'POST',
url: '/',
handler: (req, reply) => {
t.assert.strictEqual(req.body.hello, null)
reply.code(200).send(req.body)
},
schema: {
body: {
type: 'object',
properties: {
hello: {
type: 'string',
format: 'email',
nullable: true
}
}
},
response: {
200: {
type: 'object',
properties: {
hello: {
type: 'string',
format: 'email',
nullable: true
}
}
}
}
}
})
fastify.inject({
method: 'POST',
url: '/',
body: {
hello: null
}
}, (err, res) => {
t.assert.ifError(err)
t.assert.strictEqual(res.json().hello, null)
done()
})
})
test('object or null body', async (t) => {
t.plan(4)
const fastify = Fastify()
fastify.route({
method: 'POST',
// ... (128 more lines)
Source
Frequently Asked Questions
What does nullable-validation.test.js do?
nullable-validation.test.js is a source file in the fastify codebase, written in javascript.
Where is nullable-validation.test.js in the architecture?
nullable-validation.test.js is located at test/nullable-validation.test.js (directory: test).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free