Aktueller Stand
This commit is contained in:
67
backend/node_modules/find-my-way/test/case-insensitive.test.js
generated
vendored
67
backend/node_modules/find-my-way/test/case-insensitive.test.js
generated
vendored
@@ -1,7 +1,6 @@
|
||||
'use strict'
|
||||
|
||||
const t = require('tap')
|
||||
const test = t.test
|
||||
const { test } = require('node:test')
|
||||
const FindMyWay = require('../')
|
||||
|
||||
test('case insensitive static routes of level 1', t => {
|
||||
@@ -10,12 +9,12 @@ test('case insensitive static routes of level 1', t => {
|
||||
const findMyWay = FindMyWay({
|
||||
caseSensitive: false,
|
||||
defaultRoute: (req, res) => {
|
||||
t.fail('Should not be defaultRoute')
|
||||
t.assert.fail('Should not be defaultRoute')
|
||||
}
|
||||
})
|
||||
|
||||
findMyWay.on('GET', '/woo', (req, res, params) => {
|
||||
t.pass('we should be here')
|
||||
t.assert.ok('we should be here')
|
||||
})
|
||||
|
||||
findMyWay.lookup({ method: 'GET', url: '/WOO', headers: {} }, null)
|
||||
@@ -27,12 +26,12 @@ test('case insensitive static routes of level 2', t => {
|
||||
const findMyWay = FindMyWay({
|
||||
caseSensitive: false,
|
||||
defaultRoute: (req, res) => {
|
||||
t.fail('Should not be defaultRoute')
|
||||
t.assert.fail('Should not be defaultRoute')
|
||||
}
|
||||
})
|
||||
|
||||
findMyWay.on('GET', '/foo/woo', (req, res, params) => {
|
||||
t.pass('we should be here')
|
||||
t.assert.ok('we should be here')
|
||||
})
|
||||
|
||||
findMyWay.lookup({ method: 'GET', url: '/FoO/WOO', headers: {} }, null)
|
||||
@@ -44,12 +43,12 @@ test('case insensitive static routes of level 3', t => {
|
||||
const findMyWay = FindMyWay({
|
||||
caseSensitive: false,
|
||||
defaultRoute: (req, res) => {
|
||||
t.fail('Should not be defaultRoute')
|
||||
t.assert.fail('Should not be defaultRoute')
|
||||
}
|
||||
})
|
||||
|
||||
findMyWay.on('GET', '/foo/bar/woo', (req, res, params) => {
|
||||
t.pass('we should be here')
|
||||
t.assert.ok('we should be here')
|
||||
})
|
||||
|
||||
findMyWay.lookup({ method: 'GET', url: '/Foo/bAR/WoO', headers: {} }, null)
|
||||
@@ -61,12 +60,12 @@ test('parametric case insensitive', t => {
|
||||
const findMyWay = FindMyWay({
|
||||
caseSensitive: false,
|
||||
defaultRoute: (req, res) => {
|
||||
t.fail('Should not be defaultRoute')
|
||||
t.assert.fail('Should not be defaultRoute')
|
||||
}
|
||||
})
|
||||
|
||||
findMyWay.on('GET', '/foo/:param', (req, res, params) => {
|
||||
t.equal(params.param, 'bAR')
|
||||
t.assert.equal(params.param, 'bAR')
|
||||
})
|
||||
|
||||
findMyWay.lookup({ method: 'GET', url: '/Foo/bAR', headers: {} }, null)
|
||||
@@ -78,12 +77,12 @@ test('parametric case insensitive with a static part', t => {
|
||||
const findMyWay = FindMyWay({
|
||||
caseSensitive: false,
|
||||
defaultRoute: (req, res) => {
|
||||
t.fail('Should not be defaultRoute')
|
||||
t.assert.fail('Should not be defaultRoute')
|
||||
}
|
||||
})
|
||||
|
||||
findMyWay.on('GET', '/foo/my-:param', (req, res, params) => {
|
||||
t.equal(params.param, 'bAR')
|
||||
t.assert.equal(params.param, 'bAR')
|
||||
})
|
||||
|
||||
findMyWay.lookup({ method: 'GET', url: '/Foo/MY-bAR', headers: {} }, null)
|
||||
@@ -95,12 +94,12 @@ test('parametric case insensitive with capital letter', t => {
|
||||
const findMyWay = FindMyWay({
|
||||
caseSensitive: false,
|
||||
defaultRoute: (req, res) => {
|
||||
t.fail('Should not be defaultRoute')
|
||||
t.assert.fail('Should not be defaultRoute')
|
||||
}
|
||||
})
|
||||
|
||||
findMyWay.on('GET', '/foo/:Param', (req, res, params) => {
|
||||
t.equal(params.Param, 'bAR')
|
||||
t.assert.equal(params.Param, 'bAR')
|
||||
})
|
||||
|
||||
findMyWay.lookup({ method: 'GET', url: '/Foo/bAR', headers: {} }, null)
|
||||
@@ -112,12 +111,12 @@ test('case insensitive with capital letter in static path with param', t => {
|
||||
const findMyWay = FindMyWay({
|
||||
caseSensitive: false,
|
||||
defaultRoute: (req, res) => {
|
||||
t.fail('Should not be defaultRoute')
|
||||
t.assert.fail('Should not be defaultRoute')
|
||||
}
|
||||
})
|
||||
|
||||
findMyWay.on('GET', '/Foo/bar/:param', (req, res, params) => {
|
||||
t.equal(params.param, 'baZ')
|
||||
t.assert.equal(params.param, 'baZ')
|
||||
})
|
||||
|
||||
findMyWay.lookup({ method: 'GET', url: '/foo/bar/baZ', headers: {} }, null)
|
||||
@@ -133,16 +132,16 @@ test('case insensitive with multiple paths containing capital letter in static p
|
||||
const findMyWay = FindMyWay({
|
||||
caseSensitive: false,
|
||||
defaultRoute: (req, res) => {
|
||||
t.fail('Should not be defaultRoute')
|
||||
t.assert.fail('Should not be defaultRoute')
|
||||
}
|
||||
})
|
||||
|
||||
findMyWay.on('GET', '/Foo/bar/:param', (req, res, params) => {
|
||||
t.equal(params.param, 'baZ')
|
||||
t.assert.equal(params.param, 'baZ')
|
||||
})
|
||||
|
||||
findMyWay.on('GET', '/Foo/baz/:param', (req, res, params) => {
|
||||
t.equal(params.param, 'baR')
|
||||
t.assert.equal(params.param, 'baR')
|
||||
})
|
||||
|
||||
findMyWay.lookup({ method: 'GET', url: '/foo/bar/baZ', headers: {} }, null)
|
||||
@@ -155,13 +154,13 @@ test('case insensitive with multiple mixed-case params within same slash couple'
|
||||
const findMyWay = FindMyWay({
|
||||
caseSensitive: false,
|
||||
defaultRoute: (req, res) => {
|
||||
t.fail('Should not be defaultRoute')
|
||||
t.assert.fail('Should not be defaultRoute')
|
||||
}
|
||||
})
|
||||
|
||||
findMyWay.on('GET', '/foo/:param1-:param2', (req, res, params) => {
|
||||
t.equal(params.param1, 'My')
|
||||
t.equal(params.param2, 'bAR')
|
||||
t.assert.equal(params.param1, 'My')
|
||||
t.assert.equal(params.param2, 'bAR')
|
||||
})
|
||||
|
||||
findMyWay.lookup({ method: 'GET', url: '/FOO/My-bAR', headers: {} }, null)
|
||||
@@ -173,13 +172,13 @@ test('case insensitive with multiple mixed-case params', t => {
|
||||
const findMyWay = FindMyWay({
|
||||
caseSensitive: false,
|
||||
defaultRoute: (req, res) => {
|
||||
t.fail('Should not be defaultRoute')
|
||||
t.assert.fail('Should not be defaultRoute')
|
||||
}
|
||||
})
|
||||
|
||||
findMyWay.on('GET', '/foo/:param1/:param2', (req, res, params) => {
|
||||
t.equal(params.param1, 'My')
|
||||
t.equal(params.param2, 'bAR')
|
||||
t.assert.equal(params.param1, 'My')
|
||||
t.assert.equal(params.param2, 'bAR')
|
||||
})
|
||||
|
||||
findMyWay.lookup({ method: 'GET', url: '/FOO/My/bAR', headers: {} }, null)
|
||||
@@ -191,12 +190,12 @@ test('case insensitive with wildcard', t => {
|
||||
const findMyWay = FindMyWay({
|
||||
caseSensitive: false,
|
||||
defaultRoute: (req, res) => {
|
||||
t.fail('Should not be defaultRoute')
|
||||
t.assert.fail('Should not be defaultRoute')
|
||||
}
|
||||
})
|
||||
|
||||
findMyWay.on('GET', '/foo/*', (req, res, params) => {
|
||||
t.equal(params['*'], 'baR')
|
||||
t.assert.equal(params['*'], 'baR')
|
||||
})
|
||||
|
||||
findMyWay.lookup({ method: 'GET', url: '/FOO/baR', headers: {} }, null)
|
||||
@@ -208,21 +207,21 @@ test('parametric case insensitive with multiple routes', t => {
|
||||
const findMyWay = FindMyWay({
|
||||
caseSensitive: false,
|
||||
defaultRoute: (req, res) => {
|
||||
t.fail('Should not be defaultRoute')
|
||||
t.assert.fail('Should not be defaultRoute')
|
||||
}
|
||||
})
|
||||
|
||||
findMyWay.on('POST', '/foo/:param/Static/:userId/Save', (req, res, params) => {
|
||||
t.equal(params.param, 'bAR')
|
||||
t.equal(params.userId, 'one')
|
||||
t.assert.equal(params.param, 'bAR')
|
||||
t.assert.equal(params.userId, 'one')
|
||||
})
|
||||
findMyWay.on('POST', '/foo/:param/Static/:userId/Update', (req, res, params) => {
|
||||
t.equal(params.param, 'Bar')
|
||||
t.equal(params.userId, 'two')
|
||||
t.assert.equal(params.param, 'Bar')
|
||||
t.assert.equal(params.userId, 'two')
|
||||
})
|
||||
findMyWay.on('POST', '/foo/:param/Static/:userId/CANCEL', (req, res, params) => {
|
||||
t.equal(params.param, 'bAR')
|
||||
t.equal(params.userId, 'THREE')
|
||||
t.assert.equal(params.param, 'bAR')
|
||||
t.assert.equal(params.userId, 'THREE')
|
||||
})
|
||||
|
||||
findMyWay.lookup({ method: 'POST', url: '/foo/bAR/static/one/SAVE', headers: {} }, null)
|
||||
|
||||
Reference in New Issue
Block a user