// ── The UI kit's props, as core actually reads them ─────────────────────── // // React drops an unknown prop without a word, so a UI-kit component called with // the wrong one renders — just not what was written. Two of these have shipped // from this org already: `PageHeader subtitle` (Teams phase 11, the kit's // template) and `EmptyState title/message` (this module, phases 4 to 8 — every // empty panel was a blank box until the presence fix's browser walk). // // A DOM-less runner cannot see a blank box, so this reads the source instead: // it names the props core's components do NOT take and fails on any use of them. // It is a claim about core that must be re-read when core's kit changes — // written down rather than imported, because no core is in this process. import test from 'node:test' import assert from 'node:assert/strict' import fs from 'node:fs' import path from 'node:path' import { fileURLToPath } from 'node:url' const SRC = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', 'src') /** Every .jsx/.js under src/. */ function sources(dir = SRC) { return fs.readdirSync(dir, { withFileTypes: true }).flatMap((entry) => { const full = path.join(dir, entry.name) if (entry.isDirectory()) return sources(full) return /\.(jsx?|mjs)$/.test(entry.name) ? [full] : [] }) } // Core's `components/PageState.jsx` and `PageHeader.jsx`, read 2026-09-23 at the // pinned core (ci/core-ref.json). const REFUSED = { // `EmptyState({ children })` — children only. EmptyState: /]*\b(title|message|description|text)\s*=/, // `PageHeader({ eyebrow, title, lead, center })` — there is no `subtitle`. PageHeader: /]*\bsubtitle\s*=/, } test('no UI-kit component is handed a prop core does not read', () => { const offences = [] for (const file of sources()) { const text = fs.readFileSync(file, 'utf8') for (const [component, pattern] of Object.entries(REFUSED)) { if (pattern.test(text)) offences.push(`${path.relative(SRC, file)}: ${component}`) } } assert.deepEqual(offences, [], 'use components/Empty.jsx for a titled empty state') })