Files
healer-man/src/game/wow335HunterPetHappinessRuntime.test.ts
T
2026-10-02 10:38:12 -04:00

31 lines
1.4 KiB
TypeScript

import { describe, expect, it } from "vitest";
import {
WOW335_HUNTER_PET_HAPPINESS_LEVEL_SIZE,
wow335HunterPetAutoAttackDamageMultiplier,
wow335HunterPetHappinessState,
} from "./wow335HunterPetHappinessRuntime";
describe("WoW 3.3.5 Hunter pet happiness damage profile", () => {
it("uses exact unhappy/content/happy threshold boundaries", () => {
expect(WOW335_HUNTER_PET_HAPPINESS_LEVEL_SIZE).toBe(333_000);
expect(wow335HunterPetHappinessState(0)).toBe("unhappy");
expect(wow335HunterPetHappinessState(332_999)).toBe("unhappy");
expect(wow335HunterPetHappinessState(333_000)).toBe("content");
expect(wow335HunterPetHappinessState(665_999)).toBe("content");
expect(wow335HunterPetHappinessState(666_000)).toBe("happy");
});
it("applies the stock 75% / 100% / 125% base auto-attack multipliers", () => {
expect(wow335HunterPetAutoAttackDamageMultiplier(100_000)).toBe(0.75);
expect(wow335HunterPetAutoAttackDamageMultiplier(500_000)).toBe(1);
expect(wow335HunterPetAutoAttackDamageMultiplier(900_000)).toBe(1.25);
});
it("handles invalid power values as zero happiness without producing non-finite multipliers", () => {
for (const value of [Number.NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, -1]) {
expect(wow335HunterPetHappinessState(value)).toBe("unhappy");
expect(wow335HunterPetAutoAttackDamageMultiplier(value)).toBe(0.75);
}
});
});