import { describe, expect, it } from "vitest"; import { CREATE_REFERENCE_RESOURCE_CONTRACT, LIST_REFERENCE_RESOURCES_CONTRACT, } from "../../../src/features/reference-feature/contracts/reference-feature-contract-contribution.ts"; /** * Q-6.7-8 characterization. The reference feature's schemas answer through the * canonical `RuntimeValidator` protocol (array paths) of its HTTP contract. */ describe("reference validator protocols", () => { const badList = [{ id: "unsafe", name: 42 }]; it("answers the canonical validator with array paths", () => { expect( LIST_REFERENCE_RESOURCES_CONTRACT.contract.outputValidator.safeParse( badList, ), ).toEqual({ success: false, issues: [{ path: [0, "name"], code: "invalid_type" }], }); expect( CREATE_REFERENCE_RESOURCE_CONTRACT.contract.inputValidator.safeParse({ name: " Example ", }), ).toEqual({ success: true, data: { name: "Example" } }); }); });