Aktueller Stand
This commit is contained in:
33
backend/node_modules/fastify/test/has-route.test.js
generated
vendored
33
backend/node_modules/fastify/test/has-route.test.js
generated
vendored
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user