import { describe, expect, it } from "vitest"; import { ROM_KNIGHT_PANTHERS_BLESSING_SPELL_ID, romKnightPanthersBlessingRestoreOnDodge, } from "./romKnightPanthersBlessingRuntime"; const valid = { classId: "rom-knight", secondaryClassId: "rom-rogue", learnedPassiveSpellIds: [ROM_KNIGHT_PANTHERS_BLESSING_SPELL_ID], dodged: true, ownerAlive: true, maximumHealth: 1_255, currentHealth: 1_000, maximumMana: 75, currentMana: 74, } as const; describe("current CoA Knight/Rogue Panther's Blessing", () => { it("restores rounded percentages from the owner's own maximum pools and caps each pool", () => { expect(romKnightPanthersBlessingRestoreOnDodge(valid)).toEqual({ requestedHealth: 126, restoredHealth: 126, requestedMana: 1, restoredMana: 1, }); expect(romKnightPanthersBlessingRestoreOnDodge({ ...valid, currentHealth: 1_230, currentMana: 75, })).toEqual({ requestedHealth: 126, restoredHealth: 25, requestedMana: 1, restoredMana: 0, }); }); it.each([ ["wrong primary class", { classId: "rom-rogue" }], ["wrong secondary class", { secondaryClassId: "rom-warrior" }], ["passive not learned", { learnedPassiveSpellIds: [] }], ["no dodge result", { dodged: false }], ["owner is not alive", { ownerAlive: false }], ] as const)("does not trigger for %s", (_label, override) => { expect(romKnightPanthersBlessingRestoreOnDodge({ ...valid, ...override })).toBeNull(); }); });