diff --git a/src/components/insights/__tests__/insights-page-hero.test.tsx b/src/components/insights/__tests__/insights-page-hero.test.tsx deleted file mode 100644 index 513f2163e..000000000 --- a/src/components/insights/__tests__/insights-page-hero.test.tsx +++ /dev/null @@ -1,107 +0,0 @@ -import { describe, it, expect } from "vitest"; -import { renderToStaticMarkup } from "react-dom/server"; - -import { I18nProvider } from "@/lib/i18n/context"; -import { InsightsPageHero } from "../insights-page-hero"; - -/** - * v1.4.16 phase B1b — Apple-Health-style page hero. - * - * The /insights page entry-point gets a gradient hero shell: - * - h1 + subtitle (kept from the old layout, just polished) - * - "Generated " caption when an updatedAt is supplied - * - regenerate button when an onRegenerate handler is supplied - * - "Based on your last 90 days" personal-baseline indicator - * - smooth fade-in (CSS animation, gated by prefers-reduced-motion) - * - * The hero is a pure presentational shell; the page passes the values - * in. This test pins the slot positions so a future polish pass can't - * silently drop one (e.g. dropping the personal-baseline caption). - */ - -function render(node: React.ReactNode, locale: "en" | "de" = "en") { - return renderToStaticMarkup( - {node}, - ); -} - -describe("", () => { - it("renders the heading + overview subtitle", () => { - const html = render(); - expect(html).toContain("Insights"); - expect(html).toContain("Trends, risks, progress at a glance"); - }); - - it("paints a gradient background using Dracula tokens", () => { - const html = render(); - // The hero wrapper should carry a gradient + Dracula tokens so the - // page header reads as the Apple-Health-style band. - expect(html).toMatch(/data-slot="insights-page-hero"/); - expect(html).toMatch(/bg-gradient-to/); - }); - - it("renders the personal-baseline caption", () => { - const html = render(); - expect(html).toContain("Based on your last 90 days"); - }); - - it("renders the German personal-baseline caption", () => { - const html = render(, "de"); - expect(html).toContain("Basierend auf deinen letzten 90 Tagen"); - }); - - it("renders the generated-time caption when updatedAt is supplied", () => { - const fiveMinutesAgo = new Date(Date.now() - 5 * 60_000).toISOString(); - const html = render(); - // Either "just now" / "5 minutes ago" / "vor 5 Minuten" — we just - // assert the "Generated" label preceeds the relative-time string so - // a future Intl.RelativeTimeFormat tweak can't dodge the slot. - expect(html).toMatch(/data-slot="insights-page-hero-generated"/); - expect(html).toContain("Generated"); - }); - - it("does NOT render the generated caption when updatedAt is missing", () => { - const html = render(); - expect(html).not.toContain('data-slot="insights-page-hero-generated"'); - }); - - it("renders a regenerate button when onRegenerate is supplied", () => { - // The button is a real - - )} - - - ); -}