2.2 KiB
select.test-fixtures
Purpose
Wave-3h local test fixture that augments the chassis test i18n instance with
the react-ui.select.placeholder key. The chassis spec tests under
select.test.tsx assert on the resolved English string ("Select an option")
before the central wireup commit folds the canonical translation into the
bundled en-GB.json source-of-truth. Once the wireup commit lands, the
bundled key shadows the fixture and augmentI18nWithSelectKeys 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 the localized
select.placeholderstring 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 { augmentI18nWithSelectKeys } from "./select.test-fixtures.js";
const i18n = await createTestI18n({ locale: "en-GB" });
augmentI18nWithSelectKeys(i18n);
Advanced Example
import { createTestI18n } from "../../../tests/setup/test-i18n.js";
import { augmentI18nWithSelectKeys } from "./select.test-fixtures.js";
for (const locale of ["en-GB", "ar-AE", "cy-GB"] as const) {
const i18n = await createTestI18n({ locale });
augmentI18nWithSelectKeys(i18n);
// Assert against the locale-specific resolved string.
}
API Reference
augmentI18nWithSelectKeys(i18n: I18nInstance): void
Merges the bundled select keyset into the supplied i18n instance for every
supported locale. Returns nothing. Idempotent.
Implementation Notes
The fixture is intentionally tiny — five locale × one-key bundles plus a
loop. Once the wireup commit folds the canonical key 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
augmentI18nWithSelectKeys call, and the change archived as part of the
Wave 3h cleanup pass.