Files
klz-cables.com/.pnpm-store/v10/files/4e/f2872e82f9df768eaecb4892324ec106c5d88c54a6fef7c264eec7fa20df72fed29c17f8a2a80f5800e52b755e86206d60a7498cd2718b22ca039374893ee5
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

38 lines
1.2 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
'use strict'
const { test } = require('node:test')
const index = require('./index.js')
const { readdirSync } = require('node:fs')
const { basename } = require('node:path')
test(
'index exports exactly all non-test files excluding itself',
t => {
// Read all files in the `util` directory
const files = readdirSync(__dirname)
for (const file of files) {
const kebabName = basename(file, '.js')
const snakeName = kebabName.split('-').map((part, idx) => {
if (idx === 0) return part
return part[0].toUpperCase() + part.slice(1)
}).join('')
if (file.endsWith('.test.js') === false && file !== 'index.js') {
// We expect all files to be exported except…
t.assert.ok(index[snakeName], `exports ${snakeName}`)
} else {
// …test files and the index file itself those must not be exported
t.assert.ok(!index[snakeName], `does not export ${snakeName}`)
}
// Remove the exported file from the index object
delete index[snakeName]
}
// Now the index is expected to be empty, as nothing else should be
// exported from it
t.assert.deepStrictEqual(index, {}, 'does not export anything else')
}
)