import { describe, expect, it } from "vitest"; import { loadFeatureRuntime } from "../../../src/features/feature-module.ts"; import { REFERENCE_FEATURE_MODULE } from "../../../src/features/reference-feature/feature-module.ts"; import { formatMessage } from "../../../src/presentation/i18n/index.ts"; describe("REFERENCE_FEATURE_MODULE", () => { it("owns every install-time contribution under one feature id", async () => { expect(REFERENCE_FEATURE_MODULE.id).toBe("reference-feature"); expect(REFERENCE_FEATURE_MODULE.contracts).toBeDefined(); expect(REFERENCE_FEATURE_MODULE.routes).toBeDefined(); expect(REFERENCE_FEATURE_MODULE.messages).toBeDefined(); // 15-01. The executable half arrives through loadRuntime. const runtime = await loadFeatureRuntime(REFERENCE_FEATURE_MODULE); expect(runtime.featureId).toBe("reference-feature"); expect(runtime.adapters.length).toBeGreaterThan(0); expect(runtime.contractContributions.length).toBeGreaterThan(0); expect(Object.keys(runtime.schemas).length).toBeGreaterThan(0); }); it("types a feature message's parameters from its catalog placeholders", () => { // 0929/08-03. `check:types:test` is the assertion: the feature declares // `{count}` only in its catalog, and the typed call must require it. // @ts-expect-error the catalog's {count} makes the parameter required. formatMessage("ko-KR", "reference.list.resultCount"); expect( formatMessage("ko-KR", "reference.list.resultCount", { count: 1 }), ).toBe("총 1개 항목"); }); });