/** * aggregate-component-registry — the i18n ordering guard no longer depends on * `src/i18n/locales` EXISTING (audit 2026-09-24, B-WARN-14: the never-scaffolded * case yielded no error, no warning, and an aggregate without the i18n import). * A business page that CALLS the translator with zero bundle is the raw-keys * defect → hard error; a page that never calls t() cannot exhibit it → silence. */ import { describe, it, expect, beforeEach, afterEach } from 'vitest' import fs from 'node:fs' import os from 'node:os' import path from 'node:path' import { generate, hasI18nBusinessPages } from '../generate.js' let root: string beforeEach(() => { root = fs.mkdtempSync(path.join(os.tmpdir(), 'ss-agg-i18n-')) fs.mkdirSync(path.join(root, 'src'), { recursive: true }) }) afterEach(() => fs.rmSync(root, { recursive: true, force: true })) function write(rel: string, content: string): void { const abs = path.join(root, rel) fs.mkdirSync(path.dirname(abs), { recursive: true }) fs.writeFileSync(abs, content, 'utf-8') } const REGISTRY = `import { PageRegistry, lazyWithRetry } from '@atlashub/smartstack'; const JourFeriesListPage = lazyWithRetry(() => import('@/pages/JourFeriesListPage')); PageRegistry.register('myapp.rh.jours-feries', JourFeriesListPage); ` describe('i18n ordering guard × no locales dir at all', () => { it('ERRORS when a business page calls the translator and NO bundle exists anywhere (never scaffolded)', () => { write('src/extensions/myapp-rhRegistry.ts', REGISTRY) write('src/pages/JourFeriesListPage.tsx', "import { useTranslation } from 'react-i18next'\nexport default function JourFeriesListPage() { const { t } = useTranslation('rh'); return

{t('list.title')}

}\n") expect(hasI18nBusinessPages(root)).toBe(true) const { files, errors } = generate({ projectPath: root, exclude: [] }) expect(errors.some((e) => e.includes('i18n ordering guard'))).toBe(true) expect(files).toHaveLength(0) }) it('stays silent for a business page that never calls t() (nothing can render raw keys)', () => { write('src/extensions/myapp-rhRegistry.ts', REGISTRY) write('src/pages/JourFeriesListPage.tsx', 'export default function JourFeriesListPage() { return null }\n') expect(hasI18nBusinessPages(root)).toBe(false) const { errors, warnings } = generate({ projectPath: root, exclude: [] }) expect(errors).toHaveLength(0) expect(warnings.some((w) => w.includes('found NO locale bundle'))).toBe(false) }) })