import assert from "node:assert/strict"; import test from "node:test"; import { normalizePartyBuffPolicy } from "./party-buff-policy.mjs"; test("accepts explicit party, tank, and healer selections", () => { assert.deepEqual(normalizePartyBuffPolicy({ schemaVersion: 1, rules: [ { abilityId: "priest-fortitude", scope: "party" }, { abilityId: "paladin-blessing", scope: "tank" }, { abilityId: "mage-intellect", scope: "healer" }, ] }).rules.map((rule) => rule.scope), ["party", "tank", "healer"]); }); test("rejects duplicate rules and invalid scopes", () => { assert.throws(() => normalizePartyBuffPolicy({ schemaVersion: 1, rules: [ { abilityId: "fortitude", scope: "party" }, { abilityId: "fortitude", scope: "tank" }, ] }), /Duplicate/); assert.throws(() => normalizePartyBuffPolicy({ schemaVersion: 1, rules: [ { abilityId: "fortitude", scope: "everyone" }, ] }), /valid abilityId and scope/); });