import { describe, expect, it } from "vitest"; import { wow335DeathKnightWanderingPlagueIsDiseaseTag, wow335DeathKnightWanderingPlagueMeleeCritBonusPercentForTalentRanks, wow335DeathKnightWanderingPlagueProfileForRank, wow335DeathKnightWanderingPlagueProcForDiseaseTick, } from "./wow335DeathKnightWanderingPlagueRuntime"; describe("WoW Death Knight Wandering Plague runtime", () => { it("reads rank damage percentages and tooltip radius from the local talent entry", () => { expect([1, 2, 3].map(wow335DeathKnightWanderingPlagueProfileForRank)).toEqual([ { rank: 1, extraDamagePercent: 33, targetRadiusYards: 8, internalCooldownMs: 1_000 }, { rank: 2, extraDamagePercent: 66, targetRadiusYards: 8, internalCooldownMs: 1_000 }, { rank: 3, extraDamagePercent: 100, targetRadiusYards: 8, internalCooldownMs: 1_000 }, ]); expect(wow335DeathKnightWanderingPlagueProfileForRank(0)).toBeNull(); expect(wow335DeathKnightWanderingPlagueProfileForRank(Number.NaN)).toBeNull(); }); it("qualifies only Blood Plague and Frost Fever", () => { expect(wow335DeathKnightWanderingPlagueIsDiseaseTag("blood-plague")).toBe(true); expect(wow335DeathKnightWanderingPlagueIsDiseaseTag("frost-fever")).toBe(true); expect(wow335DeathKnightWanderingPlagueIsDiseaseTag("other-dot")).toBe(false); expect(wow335DeathKnightWanderingPlagueIsDiseaseTag(undefined)).toBe(false); }); it("reads only the generated global Death Knight melee-crit talent bonuses", () => { expect(wow335DeathKnightWanderingPlagueMeleeCritBonusPercentForTalentRanks({ "talent-1943": 5, "talent-2043": 3, })).toBe(8); expect(wow335DeathKnightWanderingPlagueMeleeCritBonusPercentForTalentRanks({ "talent-1943": 2, "talent-2043": 0, "talent-1945": 3, "talent-2082": 2, })).toBe(2); expect(wow335DeathKnightWanderingPlagueMeleeCritBonusPercentForTalentRanks({ "talent-1943": Number.NaN, "talent-2043": -1, })).toBe(0); }); it("uses live melee crit chance, emitted tick damage, and the owner cooldown", () => { expect(wow335DeathKnightWanderingPlagueProcForDiseaseTick( 1, "frost-fever", 100, 5, 0.049, 2_000, 2_000, )).toEqual({ extraDamage: 33, targetRadiusYards: 8, nextReadyAt: 3_000 }); expect(wow335DeathKnightWanderingPlagueProcForDiseaseTick( 3, "blood-plague", 40, 5, 0.05, 2_000, 2_000, )).toBeNull(); expect(wow335DeathKnightWanderingPlagueProcForDiseaseTick( 3, "blood-plague", 40, 5, 0, 2_999, 3_000, )).toBeNull(); expect(wow335DeathKnightWanderingPlagueProcForDiseaseTick( 3, "blood-plague", 40, 5, 0, 3_000, 3_000, )).toEqual({ extraDamage: 40, targetRadiusYards: 8, nextReadyAt: 4_000 }); }); it("ignores absent ranks, non-disease ticks, zero damage, and invalid inputs", () => { expect(wow335DeathKnightWanderingPlagueProcForDiseaseTick( 0, "blood-plague", 100, 5, 0, 1_000, 0, )).toBeNull(); expect(wow335DeathKnightWanderingPlagueProcForDiseaseTick( 3, "other-dot", 100, 5, 0, 1_000, 0, )).toBeNull(); expect(wow335DeathKnightWanderingPlagueProcForDiseaseTick( 3, "frost-fever", 0, 5, 0, 1_000, 0, )).toBeNull(); expect(wow335DeathKnightWanderingPlagueProcForDiseaseTick( 3, "frost-fever", 100, 0, 0, 1_000, 0, )).toBeNull(); expect(wow335DeathKnightWanderingPlagueProcForDiseaseTick( 3, "frost-fever", 100, 5, Number.NaN, 1_000, 0, )).toBeNull(); }); });