Files
HealthLog/src/components/settings/__tests__/layout-section.test.tsx
T
Marc-André Bombeck 537b31f4ac feat(settings): fold delivery channels into Notifications, rename the Dashboard hub to Appearance
Two surgical, additive, reversible changes to the flat settings navigation.

Notifications becomes one surface with two sequenced, labelled groups:
Reminders ("what you receive") first, then Delivery channels ("where it
lands") = the existing channels panel, unchanged. The standalone Channels
sidebar entry and slug are dropped; /settings/channels 301-redirects to
/settings/notifications#channels (mirroring the reminders redirect). The
per-channel anchors keep resolving.

The mis-titled "Dashboard" area (slug kept as layout, so no route churn) is
renamed Appearance / Darstellung and widened from two links to six: dashboard
arrangement, insights overview and pills, plus deep-links to the view/sort/
order cards of medications, labs, the illness journal, and checkups. Each
module keeps its view cards on its own page; the hub only indexes them. The
checkups view card gains a vorsorge-view anchor so the deep-link lands.

i18n updated across all six locales; settings and notifications tests track
the new structure.
2026-06-29 15:47:39 +02:00

59 lines
2.0 KiB
TypeScript

/**
* v1.17.1 (F-2) — the "Appearance" hub (slug stays `layout`).
*
* The hub is the single front door for every view/arrangement surface. It must
* link to each with consistent framing so "how my app looks" reads as one home
* rather than scattered settings sections.
*
* v1.25.3 — the hub widened from 2 links (dashboard + insights) to 6: it now
* also deep-links to the view/sort/order cards of medications, labs, the
* illness journal, and checkups. Those cards stay on their own module pages;
* the hub only indexes them via anchor deep-links.
*/
import { describe, expect, it } from "vitest";
import { renderToStaticMarkup } from "react-dom/server";
import { I18nProvider } from "@/lib/i18n/context";
import { LayoutSection } from "../layout-section";
function render(locale: "en" | "de" = "en") {
return renderToStaticMarkup(
<I18nProvider initialLocale={locale}>
<LayoutSection />
</I18nProvider>,
);
}
describe("<LayoutSection>", () => {
it("links to every view surface it indexes (anchor deep-links)", () => {
const html = render();
for (const href of [
"/settings/dashboard",
"/settings/insights",
"/settings/medications#medications-view",
"/settings/labs#labs-view",
"/settings/illness#illness-view",
"/settings/vorsorge#vorsorge-view",
]) {
expect(html).toContain(`href="${href}"`);
}
});
it("renders one card per indexed surface (6 links)", () => {
const html = render();
// Pin the link count: every hub card is an `<a href="/settings/…">`.
const links = html.match(/href="\/settings\//g) ?? [];
expect(links.length).toBe(6);
expect(html).toContain("Dashboard");
expect(html).toContain("Insights");
});
it("resolves its copy in German too", () => {
const html = render("de");
// The hub body is the link list; the German module labels resolve.
expect(html).toContain("Medikamente");
expect(html).toContain("Labor");
expect(html).not.toContain("settings.sections.layout.");
});
});