Files
2026-06-25 19:06:59 -04:00

43 lines
1.7 KiB
TypeScript

import arHomepage from '@/content/locales/ar/homepage.json';
import arShell from '@/content/locales/ar/shell.json';
import enHomepage from '@/content/locales/en/homepage.json';
import enShell from '@/content/locales/en/shell.json';
import frHomepage from '@/content/locales/fr/homepage.json';
import frShell from '@/content/locales/fr/shell.json';
import { buildHomepageContent } from '@/content/homepage-model';
import { describe, expect, it } from 'vitest';
describe('homepage content model', () => {
it.each([
['en', enHomepage, enShell],
['fr', frHomepage, frShell],
['ar', arHomepage, arShell],
] as const)('builds complete %s route content', (_locale, homepage, shell) => {
const content = buildHomepageContent(homepage, shell);
expect(content.hero.title).toBeTruthy();
expect(content.trust.items).toHaveLength(4);
expect(content.workflow.steps).toHaveLength(4);
expect(content.modules.items).toHaveLength(6);
expect(content.faq.items).toHaveLength(6);
expect(content.hero.preview.rows).toHaveLength(2);
});
it('keeps unresolved conversion destinations disabled', () => {
const content = buildHomepageContent(enHomepage, enShell);
expect(content.hero.primary.disabledReason).toBe(enShell.header.demoUnavailable);
expect(content.pricing.action.disabledReason).toBe(enShell.states.pendingBody);
expect(content.final.secondary.disabledReason).toBe(enShell.states.pendingBody);
});
it('keeps preview identifiers isolated from translated prose', () => {
const content = buildHomepageContent(arHomepage, arShell);
expect(content.hero.preview.rows.map((row) => row.secondary)).toEqual([
arHomepage.preview.plate1,
arHomepage.preview.plate2,
]);
});
});