diff --git a/src/components/ServiceCard.astro b/src/components/ServiceCard.astro new file mode 100644 index 0000000..c9f3570 --- /dev/null +++ b/src/components/ServiceCard.astro @@ -0,0 +1,18 @@ +--- +import { resolveServiceUrl } from '../i18n/services'; +import type { Service } from '../i18n/services'; +import type { Locale } from '../i18n/locale'; + +interface Props { + service: Service; + locale: Locale; +} + +const { service, locale } = Astro.props; +const url = resolveServiceUrl(service, locale); +--- + + {service.tag[locale]} +

{service.name[locale]}

+

{service.description[locale]}

+
diff --git a/src/pages/en/index.astro b/src/pages/en/index.astro index e2a8e07..d9a2b38 100644 --- a/src/pages/en/index.astro +++ b/src/pages/en/index.astro @@ -1,10 +1,25 @@ --- import BaseLayout from '../../layouts/BaseLayout.astro'; import Header from '../../components/Header.astro'; +import ServiceCard from '../../components/ServiceCard.astro'; +import { getDictionary } from '../../i18n'; +import { services } from '../../i18n/services'; const locale = 'en'; +const t = getDictionary(locale); ---
-

Ombrora

+
+
+

{t.hero.title}

+

{t.hero.subtitle}

+
+
+

{t.services.heading}

+
+ {services.map((service) => )} +
+
+
diff --git a/src/pages/fr/index.astro b/src/pages/fr/index.astro index 859a252..cb49e6d 100644 --- a/src/pages/fr/index.astro +++ b/src/pages/fr/index.astro @@ -1,10 +1,25 @@ --- import BaseLayout from '../../layouts/BaseLayout.astro'; import Header from '../../components/Header.astro'; +import ServiceCard from '../../components/ServiceCard.astro'; +import { getDictionary } from '../../i18n'; +import { services } from '../../i18n/services'; const locale = 'fr'; +const t = getDictionary(locale); ---
-

Ombrora

+
+
+

{t.hero.title}

+

{t.hero.subtitle}

+
+
+

{t.services.heading}

+
+ {services.map((service) => )} +
+
+
diff --git a/tests/services.test.ts b/tests/services.test.ts new file mode 100644 index 0000000..f148fc9 --- /dev/null +++ b/tests/services.test.ts @@ -0,0 +1,33 @@ +import { describe, it, expect, beforeAll } from 'vitest'; +import { execSync } from 'node:child_process'; +import { readFileSync } from 'node:fs'; + +describe('hero and service cards', () => { + let en: string; + let fr: string; + + beforeAll(() => { + execSync('npm run build', { stdio: 'inherit' }); + en = readFileSync('dist/en/index.html', 'utf-8'); + fr = readFileSync('dist/fr/index.html', 'utf-8'); + }); + + it('renders the localized hero copy', () => { + expect(en).toContain('The Ombrora hub'); + expect(fr).toContain('Le hub des outils Ombrora'); + }); + + it('renders the CVE Watch card with a locale-specific link', () => { + expect(en).toContain('href="https://cve-en.ombrora.com"'); + expect(fr).toContain('href="https://cve-fr.ombrora.com"'); + expect(en).toContain('CVE Watch'); + expect(fr).toContain('Veille CVE'); + }); + + it('renders the Convert card with the same link on both locales', () => { + const enMatches = en.match(/href="https:\/\/convert\.ombrora\.com"/g) ?? []; + const frMatches = fr.match(/href="https:\/\/convert\.ombrora\.com"/g) ?? []; + expect(enMatches.length).toBeGreaterThan(0); + expect(frMatches.length).toBeGreaterThan(0); + }); +});