import { describe, it, expect } from "vitest";
import { checkPropertyWriteGate, COMPILED_TRUTH_MAX_CHARS } from "../graph-write-gate.js";
describe("checkPropertyWriteGate", () => {
    it("accepts properties without compiledTruth", () => {
        expect(checkPropertyWriteGate({ properties: { name: "Adam" } })).toEqual({ ok: true });
    });
    it("accepts compiledTruth at exactly the cap", () => {
        const truth = "a".repeat(COMPILED_TRUTH_MAX_CHARS);
        expect(checkPropertyWriteGate({ properties: { compiledTruth: truth } })).toEqual({ ok: true });
    });
    it("rejects compiledTruth one char over the cap", () => {
        const truth = "a".repeat(COMPILED_TRUTH_MAX_CHARS + 1);
        const result = checkPropertyWriteGate({ properties: { compiledTruth: truth } });
        expect(result.ok).toBe(false);
        if (!result.ok) {
            expect(result.reason).toBe("compiled-truth-too-long");
            expect(result.message).toContain(String(COMPILED_TRUTH_MAX_CHARS));
        }
    });
    it("ignores non-string compiledTruth (caller will hit a different gate)", () => {
        expect(checkPropertyWriteGate({ properties: { compiledTruth: null } })).toEqual({ ok: true });
        expect(checkPropertyWriteGate({ properties: { compiledTruth: 42 } })).toEqual({ ok: true });
    });
});
//# sourceMappingURL=graph-write-gate-property.test.js.map