Files
clean-architecture-frontend…/tests/unit/installed-feature-messages.test.ts
T
DongHyeonkaandClaude Opus 5.5 1e93d30d1f refactor(platform): drop the .tsx re-export, move CI-only policies, derive message locales (Q-6.9-12)
- Delete src/features/reference-feature/presentation/reference-feature-runtime.tsx:
  it only re-exported the same-named .ts and nothing imported it by the
  .tsx path.
- Move promotion-readiness.ts and performance-budgets.ts from
  src/application/policies to scripts/lib: only scripts and their unit
  tests import them. Imports updated in 5 scripts and 2 tests.
  config/testing/risk-coverage.json lists only src modules, so their two
  criticalModules/highRiskPaths entries are removed; the synthetic
  14-file summary fixture now names two other existing src modules.
- installed-feature-messages.ts composes one catalog per locale the
  installed features declare (composeInstalledMessageCatalogs) instead
  of a fixed ko-KR/en-US list that silently dropped other catalogs. The
  exported type still maps each declared locale to its exact key set.

Verified: tests/unit/installed-feature-messages.test.ts (ko-KR/en-US
content pinned first; derived-locale and duplicate-key cases RED before);
app typecheck also passes with a zero-feature generated index; all gates
PASS; check:ci PASS; check-bundle resolves the moved module (stops later
on the absent artifacts/performance/bundle.json).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 13:58:35 +09:00

37 lines
1.4 KiB
TypeScript

import { describe, expect, it } from "vitest";
import {
composeInstalledMessageCatalogs,
INSTALLED_MESSAGE_CATALOGS,
} from "../../src/features/installed-feature-messages.ts";
import { REFERENCE_MESSAGE_CATALOGS } from "../../src/features/reference-feature/contracts/reference-message-catalog.ts";
describe("installed feature message catalogs (Q-6.9-12)", () => {
it("keeps the installed ko-KR and en-US catalogs", () => {
expect(Object.keys(INSTALLED_MESSAGE_CATALOGS).sort()).toEqual(["en-US", "ko-KR"]);
expect(INSTALLED_MESSAGE_CATALOGS["ko-KR"]).toEqual(REFERENCE_MESSAGE_CATALOGS["ko-KR"]);
expect(INSTALLED_MESSAGE_CATALOGS["en-US"]).toEqual(REFERENCE_MESSAGE_CATALOGS["en-US"]);
});
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");
});
});