refactor(settings): drop the unused section heading frame

SettingsSectionFrame re-rendered the page heading and subtitle that
SettingsShell already paints from the section slug. No route used it;
only the per-section smoke tests rendered bodies through it to assert the
visible heading and its id.

Remove the component and move the heading wrapper those tests rely on
into a test-only harness that reproduces the shell's heading markup, so
the smoke tests keep asserting what the user actually sees.
This commit is contained in:
Marc-André Bombeck committed 2026-06-27 12:46:23 +02:00
1 parent d58116e3ff
commit f4815fafe8
8 files changed
+51 -119

No files matched your search

@@ -31,7 +31,7 @@ vi.mock("@/hooks/use-auth", () => ({
}));
import { I18nProvider } from "@/lib/i18n/context";
import { SettingsSectionFrame } from "../settings-section-frame";
import { SettingsSectionFrame } from "./section-frame-harness";
import { CoachSection } from "../coach-section";
function render(locale: "en" | "de" = "en") {
@@ -44,7 +44,7 @@ vi.mock("@/hooks/use-auth", () => ({
}));
import { I18nProvider } from "@/lib/i18n/context";
import { SettingsSectionFrame } from "../settings-section-frame";
import { SettingsSectionFrame } from "./section-frame-harness";
import { ExportSection } from "../export-section";
function render(node: React.ReactElement, locale: "en" | "de" = "en") {
@@ -29,7 +29,7 @@ vi.mock("@/hooks/use-auth", () => ({
}));
import { I18nProvider } from "@/lib/i18n/context";
import { SettingsSectionFrame } from "../settings-section-frame";
import { SettingsSectionFrame } from "./section-frame-harness";
import { GesundheitsakteSection } from "../gesundheitsakte-section";
function render(node: React.ReactElement, locale: "en" | "de" = "en") {
@@ -65,7 +65,7 @@ vi.mock("@/hooks/use-auth", () => ({
}));
import { I18nProvider } from "@/lib/i18n/context";
import { SettingsSectionFrame } from "../settings-section-frame";
import { SettingsSectionFrame } from "./section-frame-harness";
import { MedicationsSection } from "../medications-section";
function render(locale: "en" | "de" = "en"): string {
@@ -131,7 +131,7 @@ vi.mock("@/hooks/use-auth", () => ({
}));
import { I18nProvider } from "@/lib/i18n/context";
import { SettingsSectionFrame } from "../settings-section-frame";
import { SettingsSectionFrame } from "./section-frame-harness";
import { MoodSection } from "../mood-section";
function render(locale: "en" | "de" = "en"): string {
@@ -0,0 +1,45 @@
"use client";
/**
* Test-only harness that reproduces the page heading the live `SettingsShell`
* paints for a given section slug (`settings-shell.tsx` headingBlock). The
* per-section SSR smoke tests render a section body through this harness so
* they can assert the visible heading + its historic `settings-section-<slug>-title`
* id alongside the body — mirroring what a user sees on the route.
*
* Production no longer wraps section bodies in a standalone frame component:
* the shell paints the heading from the slug and each section body is just its
* cards. This harness lives in `__tests__` only and is never bundled.
*/
import * as React from "react";
import { useTranslations } from "@/lib/i18n/context";
import type { SettingsSectionSlug } from "../section-slugs";
export function SettingsSectionFrame({
slug,
children,
}: {
slug: SettingsSectionSlug;
children: React.ReactNode;
}) {
const { t } = useTranslations();
const titleId = `settings-section-${slug}-title`;
return (
<section aria-labelledby={titleId} className="space-y-6">
<div className="flex items-start justify-between gap-2">
<div className="min-w-0">
<h1 id={titleId} className="text-2xl font-bold tracking-tight">
{t(`settings.sections.${slug}.title`)}
</h1>
<p className="text-muted-foreground text-sm">
{t(`settings.sections.${slug}.subtitle`)}
</p>
</div>
</div>
{children}
</section>
);
}
@@ -87,7 +87,7 @@ vi.mock("@/components/settings/thresholds-editor-section", () => ({
ThresholdsEditorSection: () => <div data-testid="thresholds-editor" />,
}));
import { I18nProvider } from "@/lib/i18n/context";
import { SettingsSectionFrame } from "../settings-section-frame";
import { SettingsSectionFrame } from "./section-frame-harness";
import type { SettingsSectionSlug } from "../section-slugs";
import { AboutSection } from "../about-section";
import { AccountSection } from "../account-section";