/**
 * `profile-update` accepts `notApplicable: boolean` as a
 * first-class declination signal.
 *
 * Validation contract (these tests):
 *   - `notApplicable: true` is mutually exclusive with non-empty `value` —
 *     a declination has no value to record. Both-set is loud-fail.
 *   - `notApplicable: true` rejects `mode: "merge"` and `mode: "contradict"`
 *     — declination is immutable; reversal goes through `profile-delete`.
 *   - `notApplicable` defaults to `false`; callers that omit it write a
 *     normal preference row.
 *
 * Write contract (covered by load-user-profile-sparse.test.ts via
 * loadUserProfile + formatProfileSummary integration):
 *   - notApplicable rows count as covered for observability (sparse-state
 *     log only — the body never enumerates absent fields).
 *   - notApplicable rows are filtered from the user-facing prose body.
 *
 * Validation throws BEFORE any session.run / embed call, so these tests
 * don't need to mock neo4j-driver or the embeddings module — the throw
 * fires in the synchronous validation block at the top of profileUpdate.
 */
import { describe, it, expect } from "vitest";
import { profileUpdate } from "../profile-update.js";
const ACCT = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee";
const USER = "user-888-validation";
describe("profile-update — notApplicable validation", () => {
    it("rejects (notApplicable: true, value: non-empty) — mutually exclusive", async () => {
        await expect(profileUpdate({
            accountId: ACCT,
            userId: USER,
            category: "communication",
            key: "preferredChannel",
            value: "whatsapp DM",
            notApplicable: true,
        })).rejects.toThrow(/mutually exclusive/);
    });
    it("rejects notApplicable: true with mode: 'merge'", async () => {
        await expect(profileUpdate({
            accountId: ACCT,
            userId: USER,
            category: "communication",
            key: "preferredChannel",
            value: "",
            mode: "merge",
            notApplicable: true,
        })).rejects.toThrow(/rejects mode "merge"/);
    });
    it("rejects notApplicable: true with mode: 'contradict'", async () => {
        await expect(profileUpdate({
            accountId: ACCT,
            userId: USER,
            category: "communication",
            key: "preferredChannel",
            value: "",
            mode: "contradict",
            notApplicable: true,
        })).rejects.toThrow(/rejects mode "contradict"/);
    });
    it("still rejects empty value when notApplicable is omitted/false (back-compat)", async () => {
        await expect(profileUpdate({
            accountId: ACCT,
            userId: USER,
            category: "communication",
            key: "preferredChannel",
            value: "",
        })).rejects.toThrow(/Value is required/);
        await expect(profileUpdate({
            accountId: ACCT,
            userId: USER,
            category: "communication",
            key: "preferredChannel",
            value: "   ",
            notApplicable: false,
        })).rejects.toThrow(/Value is required/);
    });
    it("still rejects unknown category before notApplicable check", async () => {
        await expect(profileUpdate({
            accountId: ACCT,
            userId: USER,
            category: "bogus-category",
            key: "preferredChannel",
            value: "",
            notApplicable: true,
        })).rejects.toThrow(/Invalid category/);
    });
});
//# sourceMappingURL=profile-update-not-applicable.test.js.map