Files
HealthLog/src/components/settings/__tests__/timezone-picker.test.tsx
T
Marc-André Bombeck 88028fa082 v1.4.37 — final web polish before iOS focus
Carries the v1.4.36 perf carry-over for the full /api/analytics
route (correlations + healthScore + bp_in_target on the rollup-
coverage probe, 111s cold worst-case down to ~1.5-3s on power-user
accounts), consolidates Apple Health step samples into a one-row-
per-day list view with chevron drill-down and a nightly drain
(~50x table compression once it converges), restores
IntakeHistoryListV2 to the pre-v1.4.28 contract, converges every
Coach affordance behind a single feature gate with an invariant
test pin, lifts the medication-detail Mounjaro card to byte-
equivalent parity with Ramipril, brings the Insights overview
hero row to height parity, hardens getClientIp behind a new
TRUST_CF_CONNECTING_IP env flag, ships the Arztbericht hero card
on Settings -> Export, adds the Medikamenteneinnahme quick-add
overlay to the dashboard, drops the timezone override toggle for
a silent browser-zone auto-seed, and fixes the v1.4.36 red CI
workflows. Documentation refreshed across all three repos with
five new architecture diagrams in the Dracula palette. Unit suite
4354 -> 4486 passing; typecheck + lint clean.
2026-05-17 15:36:38 +02:00

55 lines
2.1 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { renderToStaticMarkup } from "react-dom/server";
import { I18nProvider } from "@/lib/i18n/context";
import { TimezonePicker } from "../timezone-picker";
/**
* v1.4.37 — the "Browser-Zeitzone übernehmen" / "Use browser timezone"
* affordance retired. Auto-seeding now happens silently inside the
* account-section bootstrap (`detectBrowserTimezone()` on first mount
* when the stored value is still the Europe/Berlin default), so the
* picker chrome is just `<Label>` + `<NativeSelect>` + the hint line.
*
* These SSR smoke tests pin that contract end-to-end so a regression
* that re-adds either the button copy or the icon would fail the
* suite before reaching production.
*/
function render(node: React.ReactNode, locale: "en" | "de" = "en") {
return renderToStaticMarkup(
<I18nProvider initialLocale={locale}>{node}</I18nProvider>,
);
}
describe("<TimezonePicker> v1.4.37 affordance removal", () => {
it("renders the label, select, and hint without the legacy button (en)", () => {
const html = render(
<TimezonePicker value="Europe/Berlin" onChange={() => {}} />,
);
expect(html).toContain("Timezone");
expect(html).toContain("Used for chart axis labels");
expect(html).not.toContain("Use browser timezone");
});
it("renders the label, select, and hint without the legacy button (de)", () => {
const html = render(
<TimezonePicker value="Europe/Berlin" onChange={() => {}} />,
"de",
);
expect(html).toContain("Zeitzone");
expect(html).not.toContain("Browser-Zeitzone übernehmen");
});
it("keeps the stored value selectable even when not in the IANA list", () => {
// A made-up zone simulates an engine where the runtime IANA list
// has rolled but the user's stored value is still valid. The
// picker keeps the value as an extra <option> so the form does
// not silently fall back to the first list entry.
const html = render(
<TimezonePicker value="Antarctica/Casey" onChange={() => {}} />,
);
expect(html).toContain("Antarctica/Casey");
});
});