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,22 +1,17 @@
'use strict'
const t = require('tap')
const test = t.test
const Fastify = require('../fastify')
const { test, describe } = require('node:test')
const Fastify = require('..')
test('hasRoute', t => {
t.plan(5)
const test = t.test
const fastify = Fastify()
const fastify = Fastify()
describe('hasRoute', async t => {
test('hasRoute - invalid options', t => {
t.plan(3)
t.equal(fastify.hasRoute({ }), false)
t.equal(fastify.hasRoute({ method: 'GET' }), false)
t.equal(fastify.hasRoute({ constraints: [] }), false)
t.assert.strictEqual(fastify.hasRoute({ }), false)
t.assert.strictEqual(fastify.hasRoute({ method: 'GET' }), false)
t.assert.strictEqual(fastify.hasRoute({ constraints: [] }), false)
})
test('hasRoute - primitive method', t => {
@@ -29,12 +24,12 @@ test('hasRoute', t => {
}
})
t.equal(fastify.hasRoute({
t.assert.strictEqual(fastify.hasRoute({
method: 'GET',
url: '/'
}), true)
t.equal(fastify.hasRoute({
t.assert.strictEqual(fastify.hasRoute({
method: 'POST',
url: '/'
}), false)
@@ -51,13 +46,13 @@ test('hasRoute', t => {
}
})
t.equal(fastify.hasRoute({
t.assert.strictEqual(fastify.hasRoute({
method: 'GET',
url: '/',
constraints: { version: '1.2.0' }
}), true)
t.equal(fastify.hasRoute({
t.assert.strictEqual(fastify.hasRoute({
method: 'GET',
url: '/',
constraints: { version: '1.3.0' }
@@ -69,9 +64,9 @@ test('hasRoute', t => {
// parametric with regexp
fastify.get('/example/:file(^\\d+).png', function (request, reply) { })
t.equal(fastify.hasRoute({
t.assert.strictEqual(fastify.hasRoute({
method: 'GET',
url: '/example/12345.png'
url: '/example/:file(^\\d+).png'
}), true)
})
@@ -85,7 +80,7 @@ test('hasRoute', t => {
}
})
t.equal(fastify.hasRoute({
t.assert.strictEqual(fastify.hasRoute({
method: 'get',
url: '/equal'
}), true)