Files
healer-man/src/game/wow335WarriorTalentRuntime.test.ts
2026-09-30 09:57:13 -04:00

68 lines
2.2 KiB
TypeScript

import { describe, expect, it } from "vitest";
import {
WOW335_WARRIOR_BLOOD_CRAZE_DURATION_MS,
wow335WarriorBloodCrazeProfile,
wow335WarriorSecondWindProfile,
} from "./wow335WarriorTalentRuntime";
describe("WoW 3.3.5 Warrior Blood Craze tooltip mechanics", () => {
it.each([
[1, 3, 2],
[2, 1.5, 4],
[3, 1, 6],
] as const)("distributes rank %i's base-health heal across its six-second duration", (rank, intervalSeconds, ticks) => {
const profile = wow335WarriorBloodCrazeProfile(10_000, rank, false);
expect(profile).toMatchObject({
rank,
ticks,
intervalMs: intervalSeconds * 1_000,
totalHealing: rank * 100,
healingPerTick: rank * 100 / ticks,
});
expect(profile!.ticks * profile!.intervalMs).toBe(WOW335_WARRIOR_BLOOD_CRAZE_DURATION_MS);
});
it("triples the tooltip-defined total while an Enrage effect is active", () => {
expect(wow335WarriorBloodCrazeProfile(10_000, 2, true)).toMatchObject({
rank: 2,
totalHealing: 600,
healingPerTick: 150,
});
});
it("does not create a profile without an allocated rank or valid base health", () => {
expect(wow335WarriorBloodCrazeProfile(10_000, 0, false)).toBeNull();
expect(wow335WarriorBloodCrazeProfile(0, 3, false)).toBeNull();
});
});
describe("WoW 3.3.5 Warrior Second Wind tooltip mechanics", () => {
it.each([
[1, 8],
[2, 16],
[3, 24],
] as const)("builds rank %i from its generated tooltip heal", (rank, healthPercent) => {
const profile = wow335WarriorSecondWindProfile(10_000, rank);
expect(profile).toMatchObject({
rank,
healthThresholdPercent: 35,
procChancePercent: 100,
durationMs: 12_000,
cooldownMs: 30_000,
ticks: 6,
intervalMs: 2_000,
totalHealing: healthPercent * 100,
healingPerTick: healthPercent * 100 / 6,
});
expect(profile!.ticks * profile!.intervalMs).toBe(profile!.durationMs);
expect(profile!.tickAmounts.reduce((total, amount) => total + amount, 0)).toBe(profile!.totalHealing);
});
it("does not create a profile without a learned rank or valid base health", () => {
expect(wow335WarriorSecondWindProfile(10_000, 0)).toBeNull();
expect(wow335WarriorSecondWindProfile(0, 3)).toBeNull();
});
});