Six platform tests imported or named the removable reference feature, so FE-GATE-020 failed on typecheck, unit, coverage, home smoke and residue. Router surfaces now install tests/helpers/fixture-feature.tsx by mocking the generated indexes; the rest use neutral names or read the installed modules. test:sample-removal passes 13/13. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
46 lines
1.8 KiB
TypeScript
46 lines
1.8 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import {
|
|
composeInstalledMessageCatalogs,
|
|
INSTALLED_MESSAGE_CATALOGS,
|
|
} from "../../src/features/installed-feature-messages.ts";
|
|
import { INSTALLED_PRODUCT_FEATURE_MODULES } from "../../src/features/installed-product-manifest.ts";
|
|
|
|
describe("installed feature message catalogs (Q-6.9-12)", () => {
|
|
it("keeps every message each installed feature declares", () => {
|
|
// Read from the installed modules, not a named sample: the catalog is
|
|
// empty once the sample is removed (FE-GATE-020), and that is still valid.
|
|
const locales = new Set(
|
|
INSTALLED_PRODUCT_FEATURE_MODULES.flatMap((module) => Object.keys(module.messages)),
|
|
);
|
|
expect(Object.keys(INSTALLED_MESSAGE_CATALOGS).sort()).toEqual([...locales].sort());
|
|
for (const module of INSTALLED_PRODUCT_FEATURE_MODULES) {
|
|
for (const [locale, catalog] of Object.entries(module.messages)) {
|
|
expect(INSTALLED_MESSAGE_CATALOGS[locale as keyof typeof INSTALLED_MESSAGE_CATALOGS])
|
|
.toMatchObject(catalog);
|
|
}
|
|
}
|
|
});
|
|
|
|
it("composes every locale a feature declares, not a fixed list", () => {
|
|
const catalogs = composeInstalledMessageCatalogs([
|
|
{ messages: { "ko-KR": { a: "가" }, "ja-JP": { a: "あ" } } },
|
|
{ messages: { "ko-KR": { b: "나" } } },
|
|
]);
|
|
expect(catalogs).toEqual({
|
|
"ko-KR": { a: "가", b: "나" },
|
|
"ja-JP": { a: "あ" },
|
|
});
|
|
expect(Object.isFrozen(catalogs["ko-KR"])).toBe(true);
|
|
});
|
|
|
|
it("rejects a key two features define for the same locale", () => {
|
|
expect(() =>
|
|
composeInstalledMessageCatalogs([
|
|
{ messages: { "en-US": { a: "A" } } },
|
|
{ messages: { "en-US": { a: "B" } } },
|
|
]),
|
|
).toThrow("Duplicate en-US message key: a");
|
|
});
|
|
});
|