28 lines
1.4 KiB
TypeScript
28 lines
1.4 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
WOW335_PALADIN_TOUCHED_BY_THE_LIGHT_TALENT_ID,
|
|
WOW335_WARRIOR_CRITICAL_BLOCK_TALENT_ID,
|
|
wow335WarriorCriticalBlockDamage,
|
|
wow335WarriorCriticalBlockReductionPercent,
|
|
} from "./wow335WarriorCriticalBlockRuntime";
|
|
|
|
describe("WoW Warrior Critical Block runtime", () => {
|
|
it("reads the generated rank reductions and applies them only to successful eligible blocks", () => {
|
|
expect(WOW335_WARRIOR_CRITICAL_BLOCK_TALENT_ID).toBe("talent-1893");
|
|
expect(WOW335_PALADIN_TOUCHED_BY_THE_LIGHT_TALENT_ID).toBe("talent-2195");
|
|
expect([0, 1, 2, 3].map(wow335WarriorCriticalBlockReductionPercent)).toEqual([0, 8, 16, 25]);
|
|
expect(wow335WarriorCriticalBlockDamage(1_000, 0, true, false, 0)).toBe(1_000);
|
|
expect(wow335WarriorCriticalBlockDamage(1_000, 3, true, false, 0)).toBe(750);
|
|
expect(wow335WarriorCriticalBlockDamage(1_000, 3, false, false, 0)).toBe(1_000);
|
|
expect(wow335WarriorCriticalBlockDamage(1_000, 3, true, true, 0)).toBe(1_000);
|
|
expect(wow335WarriorCriticalBlockDamage(1_000, 3, true, false, 1)).toBe(1_000);
|
|
});
|
|
|
|
it("bounds invalid ranks and damage", () => {
|
|
expect(wow335WarriorCriticalBlockReductionPercent(Number.NaN)).toBe(0);
|
|
expect(wow335WarriorCriticalBlockReductionPercent(99)).toBe(25);
|
|
expect(wow335WarriorCriticalBlockDamage(Number.NaN, 3, true, false, 0)).toBe(0);
|
|
expect(wow335WarriorCriticalBlockDamage(-10, 3, true, false, 0)).toBe(0);
|
|
});
|
|
});
|