import { describe, expect, it } from "vitest"; import { applyTalentModifierValue, talentModifiersForRanks } from "./talentModifiers"; import { wow335ShamanElementalWardingModifierForRank } from "./wow335ShamanElementalWardingRuntime"; describe("WoW Shaman Elemental Warding", () => { it.each([ [1, -2], [2, -4], [3, -6], ])("reads the generated owner damage reduction at rank %i", (rank, amount) => { expect(wow335ShamanElementalWardingModifierForRank(rank)).toEqual({ kind: "damage-taken-percent", amount, unit: "percent", scope: "all Fire, Frost and Nature damage taken", }); }); it("does not create owner modifiers while untrained or for invalid rank input", () => { expect(wow335ShamanElementalWardingModifierForRank(0)).toBeNull(); expect(wow335ShamanElementalWardingModifierForRank(Number.NaN)).toBeNull(); }); it("keeps the Tethered Elemental damage and threat clauses off the Shaman", () => { const modifiers = talentModifiersForRanks({ "talent-1640": 2 }, "shaman"); expect(modifiers).toHaveLength(1); expect(modifiers[0]).toMatchObject({ kind: "damage-taken-percent", amount: -4, sourceTalentId: "talent-1640", sourceTalentName: "Elemental Warding", rank: 2, }); expect(modifiers.some((modifier) => modifier.kind === "threat-percent")).toBe(false); }); it("reduces only Fire, Frost and Nature damage", () => { const modifiers = talentModifiersForRanks({ "talent-1640": 3 }, "shaman"); for (const school of ["fire", "frost", "nature"] as const) { expect(applyTalentModifierValue(100, modifiers, "damage-taken-percent", { tags: ["magic", school], })).toBe(94); } for (const school of ["arcane", "holy", "shadow"] as const) { expect(applyTalentModifierValue(100, modifiers, "damage-taken-percent", { tags: ["magic", school], })).toBe(100); } expect(applyTalentModifierValue(100, modifiers, "damage-taken-percent", { tags: ["physical"], })).toBe(100); }); });