e51c44f486
Build & Push / Pipeline Tests (push) Successful in 1m51s
Test / Type Check (all packages) (push) Successful in 51s
Build & Push / Build & Push Docker Image (push) Failing after 4m11s
Test / API Unit Tests (push) Successful in 1m15s
Test / Homepage Unit Tests (push) Successful in 49s
Test / Carplace Unit Tests (push) Successful in 43s
Test / Admin Unit Tests (push) Successful in 42s
Test / Dashboard Unit Tests (push) Successful in 43s
Test / API Integration Tests (push) Successful in 1m5s
57 lines
2.5 KiB
TypeScript
57 lines
2.5 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 { accountCreateUrl } from '@/lib/account-urls';
|
|
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, _locale);
|
|
|
|
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.pricing.fleetBands).toHaveLength(4);
|
|
expect(content.pricing.plans).toHaveLength(3);
|
|
expect(content.hero.preview.rows).toHaveLength(2);
|
|
});
|
|
|
|
it('keeps unresolved conversion destinations disabled', () => {
|
|
const content = buildHomepageContent(enHomepage, enShell);
|
|
|
|
expect(content.hero.primary.href).toBe('/dashboard/sign-up?lang=en&theme=dark');
|
|
expect(content.hero.primary.disabledReason).toBeUndefined();
|
|
expect(content.final.primary.href).toBe('/dashboard/sign-up?lang=en&theme=dark');
|
|
expect(content.final.primary.disabledReason).toBeUndefined();
|
|
expect(content.pricing.actionDisabledReason).toBe(enShell.states.pendingBody);
|
|
expect(content.final.secondary.disabledReason).toBe(enShell.states.pendingBody);
|
|
});
|
|
|
|
it('includes explicit theme handoff in account creation URLs', () => {
|
|
expect(accountCreateUrl('en', 'light')).toBe('/dashboard/sign-up?lang=en&theme=light');
|
|
expect(accountCreateUrl('en', 'dark')).toBe('/dashboard/sign-up?lang=en&theme=dark');
|
|
expect(accountCreateUrl('en', 'dark', 'GROWTH')).toBe(
|
|
'/dashboard/sign-up?lang=en&theme=dark&plan=GROWTH',
|
|
);
|
|
});
|
|
|
|
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,
|
|
]);
|
|
});
|
|
});
|