mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-11 13:52:20 +00:00
chore(i18n): retire 414 dead translation keys across six locale bundles
Sweeps 154 dead keys per locale bundle (~924 strings across six locales) flagged by the v1.4.27 dead-key audit. Drops the insights.*Status* trio (loading / noKey / unavailable) across six metrics, the legacy `insights.aiInsights` / `dashboard.insightsPreview` roots that B1 replaced with the gated tab strip, the `insights.healthScore.askCoach` / `coachPrompt` pair retired with the inline button, the orphan onboarding.v2.* stub set, plus the ad-hoc `medications.glp1.drug.*.class` and `notifications.eventPersonalRecord*` strings that lost their callers in v1.4.25/W17. Also drops the stale prefill-format test under `health-score-card.test.tsx` that asserted the now-removed coachPrompt key shape — the negative-assertion test for the retired inline button stays in place. The locale-integrity test already validates the new shape: no re-baselining needed because the test asserts parity + no-empties rather than a key-count threshold.
This commit is contained in:
1 parent
39fef7d316
commit
2960f7352c
7 files changed
+54
-1063
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, vi } from "vitest";
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { I18nProvider, useTranslations } from "@/lib/i18n/context";
|
||||
import { I18nProvider } from "@/lib/i18n/context";
|
||||
import {
|
||||
HealthScoreCard,
|
||||
type HealthScoreCardProps,
|
||||
@@ -10,9 +10,10 @@ import {
|
||||
* v1.4.20 phase B5 — Personal Health Score card.
|
||||
*
|
||||
* SSR markup pins the slot wrappers so future polish can't silently
|
||||
* drop the score number, sub-bars or disclaimer. The interactive
|
||||
* "Ask the Coach" button is exercised through Testing Library so the
|
||||
* prefill argument forwarded to the parent handler stays stable.
|
||||
* drop the score number, sub-bars or disclaimer. The inline
|
||||
* Ask-the-Coach button retired in v1.4.27 B1 — the hero strip
|
||||
* carries the CTA. The negative-assertion test below pins that
|
||||
* decision so a future revival has to update the test in lock-step.
|
||||
*/
|
||||
|
||||
const baseComponents: HealthScoreCardProps["components"] = {
|
||||
@@ -205,32 +206,6 @@ describe("<HealthScoreCard>", () => {
|
||||
expect(supplied).not.toContain('data-slot="health-score-card-ask-coach"');
|
||||
});
|
||||
|
||||
it("captures the score-aware prefill argument when the button is invoked", () => {
|
||||
// The handler closure receives `t("insights.healthScore.coachPrompt", { score })`
|
||||
// which interpolates the current score. We assert the closure shape by
|
||||
// probing the i18n provider directly rather than wiring a DOM testing
|
||||
// library — the component's onClick lambda is one line and its
|
||||
// contract is the prefill string format, not the click plumbing.
|
||||
let captured: string | null = null;
|
||||
const onAskCoach = vi.fn((prefill: string) => {
|
||||
captured = prefill;
|
||||
});
|
||||
|
||||
function Probe() {
|
||||
const { t } = useTranslations();
|
||||
// Reproduce the same call the button's onClick performs.
|
||||
onAskCoach(t("insights.healthScore.coachPrompt", { score: 86 }));
|
||||
return null;
|
||||
}
|
||||
|
||||
renderToStaticMarkup(
|
||||
<I18nProvider initialLocale="en">
|
||||
<Probe />
|
||||
</I18nProvider>,
|
||||
);
|
||||
expect(onAskCoach).toHaveBeenCalledTimes(1);
|
||||
expect(captured).toBe("Why is my health score 86 out of 100?");
|
||||
});
|
||||
|
||||
it("renders German strings", () => {
|
||||
const html = ssr(
|
||||
|
||||
Reference in new issue
Block a user