Aktueller Stand
This commit is contained in:
35
backend/node_modules/find-my-way/test/issue-247.test.js
generated
vendored
35
backend/node_modules/find-my-way/test/issue-247.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('If there are constraints param, router.off method support filter', t => {
|
||||
@@ -12,27 +11,27 @@ test('If there are constraints param, router.off method support filter', t => {
|
||||
findMyWay.on('GET', '/a', { constraints: { host: '2', version: '1.0.0' } }, () => {}, { name: 2 })
|
||||
findMyWay.on('GET', '/a', { constraints: { host: '2', version: '2.0.0' } }, () => {}, { name: 3 })
|
||||
|
||||
t.same(findMyWay.find('GET', '/a', { host: '1' }).store, { name: 1 })
|
||||
t.same(findMyWay.find('GET', '/a', { host: '2', version: '1.0.0' }).store, { name: 2 })
|
||||
t.same(findMyWay.find('GET', '/a', { host: '2', version: '2.0.0' }).store, { name: 3 })
|
||||
t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '1' }).store, { name: 1 })
|
||||
t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '2', version: '1.0.0' }).store, { name: 2 })
|
||||
t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '2', version: '2.0.0' }).store, { name: 3 })
|
||||
|
||||
findMyWay.off('GET', '/a', { host: '1' })
|
||||
|
||||
t.same(findMyWay.find('GET', '/a', { host: '1' }), null)
|
||||
t.same(findMyWay.find('GET', '/a', { host: '2', version: '1.0.0' }).store, { name: 2 })
|
||||
t.same(findMyWay.find('GET', '/a', { host: '2', version: '2.0.0' }).store, { name: 3 })
|
||||
t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '1' }), null)
|
||||
t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '2', version: '1.0.0' }).store, { name: 2 })
|
||||
t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '2', version: '2.0.0' }).store, { name: 3 })
|
||||
|
||||
findMyWay.off('GET', '/a', { host: '2', version: '1.0.0' })
|
||||
|
||||
t.same(findMyWay.find('GET', '/a', { host: '1' }), null)
|
||||
t.same(findMyWay.find('GET', '/a', { host: '2', version: '1.0.0' }), null)
|
||||
t.same(findMyWay.find('GET', '/a', { host: '2', version: '2.0.0' }).store, { name: 3 })
|
||||
t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '1' }), null)
|
||||
t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '2', version: '1.0.0' }), null)
|
||||
t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '2', version: '2.0.0' }).store, { name: 3 })
|
||||
|
||||
findMyWay.off('GET', '/a', { host: '2', version: '2.0.0' })
|
||||
|
||||
t.same(findMyWay.find('GET', '/a', { host: '1' }), null)
|
||||
t.same(findMyWay.find('GET', '/a', { host: '2', version: '1.0.0' }), null)
|
||||
t.same(findMyWay.find('GET', '/a', { host: '2', version: '2.0.0' }), null)
|
||||
t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '1' }), null)
|
||||
t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '2', version: '1.0.0' }), null)
|
||||
t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '2', version: '2.0.0' }), null)
|
||||
})
|
||||
|
||||
test('If there are no constraints param, router.off method remove all matched router', t => {
|
||||
@@ -42,11 +41,11 @@ test('If there are no constraints param, router.off method remove all matched ro
|
||||
findMyWay.on('GET', '/a', { constraints: { host: '1' } }, () => {}, { name: 1 })
|
||||
findMyWay.on('GET', '/a', { constraints: { host: '2' } }, () => {}, { name: 2 })
|
||||
|
||||
t.same(findMyWay.find('GET', '/a', { host: '1' }).store, { name: 1 })
|
||||
t.same(findMyWay.find('GET', '/a', { host: '2' }).store, { name: 2 })
|
||||
t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '1' }).store, { name: 1 })
|
||||
t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '2' }).store, { name: 2 })
|
||||
|
||||
findMyWay.off('GET', '/a')
|
||||
|
||||
t.same(findMyWay.find('GET', '/a', { host: '1' }), null)
|
||||
t.same(findMyWay.find('GET', '/a', { host: '2' }), null)
|
||||
t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '1' }), null)
|
||||
t.assert.deepEqual(findMyWay.find('GET', '/a', { host: '2' }), null)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user