Aktueller Stand
This commit is contained in:
24
backend/node_modules/find-my-way/test/host-storage.test.js
generated
vendored
24
backend/node_modules/find-my-way/test/host-storage.test.js
generated
vendored
@@ -1,27 +1,27 @@
|
||||
const acceptHostStrategy = require('../lib/strategies/accept-host')
|
||||
|
||||
const t = require('tap')
|
||||
const { test } = require('node:test')
|
||||
|
||||
t.test('can get hosts by exact matches', async (t) => {
|
||||
test('can get hosts by exact matches', async (t) => {
|
||||
const storage = acceptHostStrategy.storage()
|
||||
t.equal(storage.get('fastify.io'), undefined)
|
||||
t.assert.equal(storage.get('fastify.io'), undefined)
|
||||
storage.set('fastify.io', true)
|
||||
t.equal(storage.get('fastify.io'), true)
|
||||
t.assert.equal(storage.get('fastify.io'), true)
|
||||
})
|
||||
|
||||
t.test('can get hosts by regexp matches', async (t) => {
|
||||
test('can get hosts by regexp matches', async (t) => {
|
||||
const storage = acceptHostStrategy.storage()
|
||||
t.equal(storage.get('fastify.io'), undefined)
|
||||
t.assert.equal(storage.get('fastify.io'), undefined)
|
||||
storage.set(/.+fastify\.io/, true)
|
||||
t.equal(storage.get('foo.fastify.io'), true)
|
||||
t.equal(storage.get('bar.fastify.io'), true)
|
||||
t.assert.equal(storage.get('foo.fastify.io'), true)
|
||||
t.assert.equal(storage.get('bar.fastify.io'), true)
|
||||
})
|
||||
|
||||
t.test('exact host matches take precendence over regexp matches', async (t) => {
|
||||
test('exact host matches take precendence over regexp matches', async (t) => {
|
||||
const storage = acceptHostStrategy.storage()
|
||||
storage.set(/.+fastify\.io/, 'wildcard')
|
||||
storage.set('auth.fastify.io', 'exact')
|
||||
t.equal(storage.get('foo.fastify.io'), 'wildcard')
|
||||
t.equal(storage.get('bar.fastify.io'), 'wildcard')
|
||||
t.equal(storage.get('auth.fastify.io'), 'exact')
|
||||
t.assert.equal(storage.get('foo.fastify.io'), 'wildcard')
|
||||
t.assert.equal(storage.get('bar.fastify.io'), 'wildcard')
|
||||
t.assert.equal(storage.get('auth.fastify.io'), 'exact')
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user