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,19 +1,18 @@
'use strict'
const t = require('tap')
const test = t.test
const { test } = require('node:test')
const FindMyWay = require('../')
test('Standard case', t => {
t.plan(1)
const findMyWay = FindMyWay({
defaultRoute: (req, res) => {
t.fail('Should not be here')
t.assert.fail('Should not be here')
}
})
findMyWay.on('GET', '/a/:param', (req, res, params) => {
t.equal(params.param, 'perfectly-fine-route')
t.assert.equal(params.param, 'perfectly-fine-route')
})
findMyWay.lookup({ method: 'GET', url: '/a/perfectly-fine-route', headers: {} }, null)
@@ -23,12 +22,12 @@ test('Should be 404 / 1', t => {
t.plan(1)
const findMyWay = FindMyWay({
defaultRoute: (req, res) => {
t.pass('Everything good')
t.assert.ok('Everything good')
}
})
findMyWay.on('GET', '/a/:param', (req, res, params) => {
t.fail('We should not be here')
t.assert.fail('We should not be here')
})
findMyWay.lookup({ method: 'GET', url: '/a', headers: {} }, null)
@@ -38,12 +37,12 @@ test('Should be 404 / 2', t => {
t.plan(1)
const findMyWay = FindMyWay({
defaultRoute: (req, res) => {
t.pass('Everything good')
t.assert.ok('Everything good')
}
})
findMyWay.on('GET', '/a/:param', (req, res, params) => {
t.fail('We should not be here')
t.assert.fail('We should not be here')
})
findMyWay.lookup({ method: 'GET', url: '/a-non-existing-route', headers: {} }, null)
@@ -53,12 +52,12 @@ test('Should be 404 / 3', t => {
t.plan(1)
const findMyWay = FindMyWay({
defaultRoute: (req, res) => {
t.pass('Everything good')
t.assert.ok('Everything good')
}
})
findMyWay.on('GET', '/a/:param', (req, res, params) => {
t.fail('We should not be here')
t.assert.fail('We should not be here')
})
findMyWay.lookup({ method: 'GET', url: '/a//', headers: {} }, null)
@@ -68,12 +67,12 @@ test('Should get an empty parameter', t => {
t.plan(1)
const findMyWay = FindMyWay({
defaultRoute: (req, res) => {
t.fail('We should not be here')
t.assert.fail('We should not be here')
}
})
findMyWay.on('GET', '/a/:param', (req, res, params) => {
t.equal(params.param, '')
t.assert.equal(params.param, '')
})
findMyWay.lookup({ method: 'GET', url: '/a/', headers: {} }, null)