Files
klz-cables.com/.pnpm-store/v10/files/fd/d8686c766b510180886c5dfe64fdd1297f18cbb74c9a746def9517f30dbdcf7433c0610f897fe8e29efd1d5d13a7ba54ca860406dc906b78e306a1ddbdf82c
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

71 lines
1.5 KiB
Plaintext

'use strict'
const { test } = require('node:test')
const prettifyLevel = require('./prettify-level')
const getColorizer = require('../colors')
const getLevelLabelData = require('./get-level-label-data')
const {
LEVEL_KEY
} = require('../constants')
const context = {
colorizer: getColorizer(),
customLevelNames: undefined,
customLevels: undefined,
levelKey: LEVEL_KEY,
customPrettifiers: undefined,
getLevelLabelData: getLevelLabelData(false, {}, {})
}
test('returns `undefined` for unknown level', t => {
const colorized = prettifyLevel({
log: {},
context: {
...context
}
})
t.assert.strictEqual(colorized, undefined)
})
test('returns non-colorized value for default colorizer', t => {
const log = {
level: 30
}
const colorized = prettifyLevel({
log,
context: {
...context
}
})
t.assert.strictEqual(colorized, 'INFO')
})
test('returns colorized value for color colorizer', t => {
const log = {
level: 30
}
const colorizer = getColorizer(true)
const colorized = prettifyLevel({
log,
context: {
...context,
colorizer
}
})
t.assert.strictEqual(colorized, '\u001B[32mINFO\u001B[39m')
})
test('passes output through provided prettifier', t => {
const log = {
level: 30
}
const colorized = prettifyLevel({
log,
context: {
...context,
customPrettifiers: { level () { return 'modified' } }
}
})
t.assert.strictEqual(colorized, 'modified')
})