2.2 KiB
calendar.test-fixtures
Purpose
Wave-3h local test fixture that augments the chassis test i18n instance with
the react-ui.calendar.* keyset. The chassis spec tests under
calendar.test.tsx assert on the resolved English strings ("Calendar",
"Previous month", "Next month") before the central wireup commit folds the
canonical translations into the bundled en-GB.json source-of-truth. Once the
wireup commit lands, the bundled keys shadow the fixture and
augmentI18nWithCalendarKeys becomes a no-op re-merge — the fixture stays in
place during the deletion window so the deletion can land as a single atomic
cleanup pass without breaking the suite mid-rebase.
Features
- Bundles localized
calendarstrings for all five chassis-supported locales (en-GB,zh-CN,ar-AE,cy-GB,ru-RU) - Idempotent merge — calling the augment function twice against the same instance is a no-op
- Zero coupling to the call-site structure: the augment helper accepts any
I18nInstance
Usage
Basic Example
import { createTestI18n } from "../../../tests/setup/test-i18n.js";
import { augmentI18nWithCalendarKeys } from "./calendar.test-fixtures.js";
const i18n = await createTestI18n({ locale: "en-GB" });
augmentI18nWithCalendarKeys(i18n);
Advanced Example
import { createTestI18n } from "../../../tests/setup/test-i18n.js";
import { augmentI18nWithCalendarKeys } from "./calendar.test-fixtures.js";
for (const locale of ["en-GB", "ar-AE", "cy-GB"] as const) {
const i18n = await createTestI18n({ locale });
augmentI18nWithCalendarKeys(i18n);
// Assert against the locale-specific resolved strings.
}
API Reference
augmentI18nWithCalendarKeys(i18n: I18nInstance): void
Merges the bundled calendar keyset into the supplied i18n instance for every
supported locale. Returns nothing. Idempotent.
Implementation Notes
The fixture is intentionally tiny — five locale × three-key bundles plus a
loop. Once the wireup commit folds the canonical keys into the chassis
en-GB.json source-of-truth, this file will be removed alongside its .md
sibling, the spec test imports rewritten to drop the
augmentI18nWithCalendarKeys call, and the change archived as part of the
Wave 3h cleanup pass.