Aktueller Stand
This commit is contained in:
52
backend/node_modules/find-my-way/test/path-params-match.test.js
generated
vendored
52
backend/node_modules/find-my-way/test/path-params-match.test.js
generated
vendored
@@ -1,9 +1,9 @@
|
||||
'use strict'
|
||||
|
||||
const t = require('tap')
|
||||
const { test } = require('node:test')
|
||||
const FindMyWay = require('../')
|
||||
|
||||
t.test('path params match', (t) => {
|
||||
test('path params match', (t) => {
|
||||
t.plan(24)
|
||||
|
||||
const findMyWay = FindMyWay({ ignoreTrailingSlash: true, ignoreDuplicateSlashes: true })
|
||||
@@ -18,36 +18,36 @@ t.test('path params match', (t) => {
|
||||
findMyWay.on('GET', '/ac', cPath)
|
||||
findMyWay.on('GET', '/:pam', paramPath)
|
||||
|
||||
t.equal(findMyWay.find('GET', '/ab1').handler, b1Path)
|
||||
t.equal(findMyWay.find('GET', '/ab1/').handler, b1Path)
|
||||
t.equal(findMyWay.find('GET', '//ab1').handler, b1Path)
|
||||
t.equal(findMyWay.find('GET', '//ab1//').handler, b1Path)
|
||||
t.equal(findMyWay.find('GET', '/ab2').handler, b2Path)
|
||||
t.equal(findMyWay.find('GET', '/ab2/').handler, b2Path)
|
||||
t.equal(findMyWay.find('GET', '//ab2').handler, b2Path)
|
||||
t.equal(findMyWay.find('GET', '//ab2//').handler, b2Path)
|
||||
t.equal(findMyWay.find('GET', '/ac').handler, cPath)
|
||||
t.equal(findMyWay.find('GET', '/ac/').handler, cPath)
|
||||
t.equal(findMyWay.find('GET', '//ac').handler, cPath)
|
||||
t.equal(findMyWay.find('GET', '//ac//').handler, cPath)
|
||||
t.equal(findMyWay.find('GET', '/foo').handler, paramPath)
|
||||
t.equal(findMyWay.find('GET', '/foo/').handler, paramPath)
|
||||
t.equal(findMyWay.find('GET', '//foo').handler, paramPath)
|
||||
t.equal(findMyWay.find('GET', '//foo//').handler, paramPath)
|
||||
t.assert.equal(findMyWay.find('GET', '/ab1').handler, b1Path)
|
||||
t.assert.equal(findMyWay.find('GET', '/ab1/').handler, b1Path)
|
||||
t.assert.equal(findMyWay.find('GET', '//ab1').handler, b1Path)
|
||||
t.assert.equal(findMyWay.find('GET', '//ab1//').handler, b1Path)
|
||||
t.assert.equal(findMyWay.find('GET', '/ab2').handler, b2Path)
|
||||
t.assert.equal(findMyWay.find('GET', '/ab2/').handler, b2Path)
|
||||
t.assert.equal(findMyWay.find('GET', '//ab2').handler, b2Path)
|
||||
t.assert.equal(findMyWay.find('GET', '//ab2//').handler, b2Path)
|
||||
t.assert.equal(findMyWay.find('GET', '/ac').handler, cPath)
|
||||
t.assert.equal(findMyWay.find('GET', '/ac/').handler, cPath)
|
||||
t.assert.equal(findMyWay.find('GET', '//ac').handler, cPath)
|
||||
t.assert.equal(findMyWay.find('GET', '//ac//').handler, cPath)
|
||||
t.assert.equal(findMyWay.find('GET', '/foo').handler, paramPath)
|
||||
t.assert.equal(findMyWay.find('GET', '/foo/').handler, paramPath)
|
||||
t.assert.equal(findMyWay.find('GET', '//foo').handler, paramPath)
|
||||
t.assert.equal(findMyWay.find('GET', '//foo//').handler, paramPath)
|
||||
|
||||
const noTrailingSlashRet = findMyWay.find('GET', '/abcdef')
|
||||
t.equal(noTrailingSlashRet.handler, paramPath)
|
||||
t.same(noTrailingSlashRet.params, { pam: 'abcdef' })
|
||||
t.assert.equal(noTrailingSlashRet.handler, paramPath)
|
||||
t.assert.deepEqual(noTrailingSlashRet.params, { pam: 'abcdef' })
|
||||
|
||||
const trailingSlashRet = findMyWay.find('GET', '/abcdef/')
|
||||
t.equal(trailingSlashRet.handler, paramPath)
|
||||
t.same(trailingSlashRet.params, { pam: 'abcdef' })
|
||||
t.assert.equal(trailingSlashRet.handler, paramPath)
|
||||
t.assert.deepEqual(trailingSlashRet.params, { pam: 'abcdef' })
|
||||
|
||||
const noDuplicateSlashRet = findMyWay.find('GET', '/abcdef')
|
||||
t.equal(noDuplicateSlashRet.handler, paramPath)
|
||||
t.same(noDuplicateSlashRet.params, { pam: 'abcdef' })
|
||||
t.assert.equal(noDuplicateSlashRet.handler, paramPath)
|
||||
t.assert.deepEqual(noDuplicateSlashRet.params, { pam: 'abcdef' })
|
||||
|
||||
const duplicateSlashRet = findMyWay.find('GET', '//abcdef')
|
||||
t.equal(duplicateSlashRet.handler, paramPath)
|
||||
t.same(duplicateSlashRet.params, { pam: 'abcdef' })
|
||||
t.assert.equal(duplicateSlashRet.handler, paramPath)
|
||||
t.assert.deepEqual(duplicateSlashRet.params, { pam: 'abcdef' })
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user