import { describe, expect, it } from "vitest"; import { ContractContributionError, composeContractContributions, } from "../../../src/contracts/external-contract-runtime.ts"; import { REFERENCE_FEATURE_TEMPLATE_CONTRIBUTION } from "../../../src/features/reference-feature/contracts/reference-feature-contract-contribution.ts"; // 07-04 (ยง4.8). The product-feature rejection is in // tests/unit/external-contract-runtime.test.ts. describe("reference template fixture provenance", () => { it("installs the fixture outside the release contract set", () => { const composed = composeContractContributions([ REFERENCE_FEATURE_TEMPLATE_CONTRIBUTION, ]); expect(composed.contributions).toHaveLength(1); expect(composed.externalPackages).toHaveLength(0); }); it("rejects a second fixture contribution from the same feature", () => { const second = Object.freeze({ ...REFERENCE_FEATURE_TEMPLATE_CONTRIBUTION, contributionId: "reference-feature-http-v2", http: Object.freeze([]), }); let reason: string | undefined; try { composeContractContributions([REFERENCE_FEATURE_TEMPLATE_CONTRIBUTION, second]); } catch (error) { expect(error).toBeInstanceOf(ContractContributionError); reason = (error as ContractContributionError).reason; } expect(reason).toBe( "reference-feature: only one TEMPLATE_FIXTURE contribution is allowed", ); }); });