Aktueller Stand
This commit is contained in:
51
backend/node_modules/find-my-way/test/issue-44.test.js
generated
vendored
51
backend/node_modules/find-my-way/test/issue-44.test.js
generated
vendored
@@ -1,23 +1,22 @@
|
||||
'use strict'
|
||||
|
||||
const t = require('tap')
|
||||
const test = t.test
|
||||
const { test } = require('node:test')
|
||||
const FindMyWay = require('../')
|
||||
|
||||
test('Parametric and static with shared prefix / 1', t => {
|
||||
t.plan(1)
|
||||
const findMyWay = FindMyWay({
|
||||
defaultRoute: (req, res) => {
|
||||
t.fail('Should not be defaultRoute')
|
||||
t.assert.fail('Should not be defaultRoute')
|
||||
}
|
||||
})
|
||||
|
||||
findMyWay.on('GET', '/woo', (req, res, params) => {
|
||||
t.fail('we should not be here')
|
||||
t.assert.fail('we should not be here')
|
||||
})
|
||||
|
||||
findMyWay.on('GET', '/:param', (req, res, params) => {
|
||||
t.equal(params.param, 'winter')
|
||||
t.assert.equal(params.param, 'winter')
|
||||
})
|
||||
|
||||
findMyWay.lookup({ method: 'GET', url: '/winter', headers: {} }, null)
|
||||
@@ -27,16 +26,16 @@ test('Parametric and static with shared prefix / 2', t => {
|
||||
t.plan(1)
|
||||
const findMyWay = FindMyWay({
|
||||
defaultRoute: (req, res) => {
|
||||
t.fail('Should not be defaultRoute')
|
||||
t.assert.fail('Should not be defaultRoute')
|
||||
}
|
||||
})
|
||||
|
||||
findMyWay.on('GET', '/woo', (req, res, params) => {
|
||||
t.ok('we should be here')
|
||||
t.assert.ok('we should be here')
|
||||
})
|
||||
|
||||
findMyWay.on('GET', '/:param', (req, res, params) => {
|
||||
t.fail('we should not be here')
|
||||
t.assert.fail('we should not be here')
|
||||
})
|
||||
|
||||
findMyWay.lookup({ method: 'GET', url: '/woo', headers: {} }, null)
|
||||
@@ -46,16 +45,16 @@ test('Parametric and static with shared prefix (nested)', t => {
|
||||
t.plan(1)
|
||||
const findMyWay = FindMyWay({
|
||||
defaultRoute: (req, res) => {
|
||||
t.ok('We should be here')
|
||||
t.assert.ok('We should be here')
|
||||
}
|
||||
})
|
||||
|
||||
findMyWay.on('GET', '/woo', (req, res, params) => {
|
||||
t.fail('we should not be here')
|
||||
t.assert.fail('we should not be here')
|
||||
})
|
||||
|
||||
findMyWay.on('GET', '/:param', (req, res, params) => {
|
||||
t.fail('we should not be here')
|
||||
t.assert.fail('we should not be here')
|
||||
})
|
||||
|
||||
findMyWay.lookup({ method: 'GET', url: '/winter/coming', headers: {} }, null)
|
||||
@@ -65,16 +64,16 @@ test('Parametric and static with shared prefix and different suffix', 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', '/example/shared/nested/test', (req, res, params) => {
|
||||
t.fail('We should not be here')
|
||||
t.assert.fail('We should not be here')
|
||||
})
|
||||
|
||||
findMyWay.on('GET', '/example/:param/nested/other', (req, res, params) => {
|
||||
t.ok('We should be here')
|
||||
t.assert.ok('We should be here')
|
||||
})
|
||||
|
||||
findMyWay.lookup({ method: 'GET', url: '/example/shared/nested/other', headers: {} }, null)
|
||||
@@ -84,20 +83,20 @@ test('Parametric and static with shared prefix (with wildcard)', t => {
|
||||
t.plan(1)
|
||||
const findMyWay = FindMyWay({
|
||||
defaultRoute: (req, res) => {
|
||||
t.fail('Should not be defaultRoute')
|
||||
t.assert.fail('Should not be defaultRoute')
|
||||
}
|
||||
})
|
||||
|
||||
findMyWay.on('GET', '/woo', (req, res, params) => {
|
||||
t.fail('we should not be here')
|
||||
t.assert.fail('we should not be here')
|
||||
})
|
||||
|
||||
findMyWay.on('GET', '/:param', (req, res, params) => {
|
||||
t.equal(params.param, 'winter')
|
||||
t.assert.equal(params.param, 'winter')
|
||||
})
|
||||
|
||||
findMyWay.on('GET', '/*', (req, res, params) => {
|
||||
t.fail('we should not be here')
|
||||
t.assert.fail('we should not be here')
|
||||
})
|
||||
|
||||
findMyWay.lookup({ method: 'GET', url: '/winter', headers: {} }, null)
|
||||
@@ -107,20 +106,20 @@ test('Parametric and static with shared prefix (nested with wildcard)', t => {
|
||||
t.plan(1)
|
||||
const findMyWay = FindMyWay({
|
||||
defaultRoute: (req, res) => {
|
||||
t.fail('Should not be defaultRoute')
|
||||
t.assert.fail('Should not be defaultRoute')
|
||||
}
|
||||
})
|
||||
|
||||
findMyWay.on('GET', '/woo', (req, res, params) => {
|
||||
t.fail('we should not be here')
|
||||
t.assert.fail('we should not be here')
|
||||
})
|
||||
|
||||
findMyWay.on('GET', '/:param', (req, res, params) => {
|
||||
t.fail('we should not be here')
|
||||
t.assert.fail('we should not be here')
|
||||
})
|
||||
|
||||
findMyWay.on('GET', '/*', (req, res, params) => {
|
||||
t.equal(params['*'], 'winter/coming')
|
||||
t.assert.equal(params['*'], 'winter/coming')
|
||||
})
|
||||
|
||||
findMyWay.lookup({ method: 'GET', url: '/winter/coming', headers: {} }, null)
|
||||
@@ -130,20 +129,20 @@ test('Parametric and static with shared prefix (nested with split)', 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', '/woo', (req, res, params) => {
|
||||
t.fail('we should not be here')
|
||||
t.assert.fail('we should not be here')
|
||||
})
|
||||
|
||||
findMyWay.on('GET', '/:param', (req, res, params) => {
|
||||
t.equal(params.param, 'winter')
|
||||
t.assert.equal(params.param, 'winter')
|
||||
})
|
||||
|
||||
findMyWay.on('GET', '/wo', (req, res, params) => {
|
||||
t.fail('we should not be here')
|
||||
t.assert.fail('we should not be here')
|
||||
})
|
||||
|
||||
findMyWay.lookup({ method: 'GET', url: '/winter', headers: {} }, null)
|
||||
|
||||
Reference in New Issue
Block a user