Files
klz-cables.com/.pnpm-store/v10/files/e2/769c0a5723d787fa551b7eb645bb7f04d02315402c25dc833e945d3fb82a7d8418bac2bc36d0d2d0cea0ed792569b7c9b7afc70f0ffd77cb57e1cb581cc69d
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

48 lines
1.2 KiB
Plaintext

'use strict'
const { test } = require('node:test')
const handleCustomLevelsOpts = require('./handle-custom-levels-opts')
test('returns a empty object `{}` for undefined parameter', t => {
const handledCustomLevel = handleCustomLevelsOpts()
t.assert.deepStrictEqual(handledCustomLevel, {})
})
test('returns a empty object `{}` for unknown parameter', t => {
const handledCustomLevel = handleCustomLevelsOpts(123)
t.assert.deepStrictEqual(handledCustomLevel, {})
})
test('returns a filled object for string parameter', t => {
const handledCustomLevel = handleCustomLevelsOpts('ok:10,warn:20,error:35')
t.assert.deepStrictEqual(handledCustomLevel, {
10: 'OK',
20: 'WARN',
35: 'ERROR',
default: 'USERLVL'
})
})
test('returns a filled object for object parameter', t => {
const handledCustomLevel = handleCustomLevelsOpts({
ok: 10,
warn: 20,
error: 35
})
t.assert.deepStrictEqual(handledCustomLevel, {
10: 'OK',
20: 'WARN',
35: 'ERROR',
default: 'USERLVL'
})
})
test('defaults missing level num to first index', t => {
const result = handleCustomLevelsOpts('ok:10,info')
t.assert.deepStrictEqual(result, {
10: 'OK',
1: 'INFO',
default: 'USERLVL'
})
})