Files
healer-man/src/game/benchmark/benchmarkRunner.test.ts
T
2026-08-30 14:16:56 -04:00

45 lines
2.1 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { loadCanonicalBenchmarkBuilds } from "./benchmarkBuilds";
import { runCombatBenchmark } from "./benchmarkRunner";
import { benchmarkScenarioById } from "./benchmarkScenarios";
describe("combat benchmark runner", () => {
it("replays the authoritative player path deterministically", async () => {
const [build] = await loadCanonicalBenchmarkBuilds(60, ["mage"]);
const scenario = benchmarkScenarioById("damage-single-burst")!;
const options = { seed: 42, durationScale: 0.12 } as const;
const first = await runCombatBenchmark(build, scenario, options);
const second = await runCombatBenchmark(build, scenario, options);
expect(second).toEqual(first);
expect(first.validation).toEqual({ valid: true, reasons: [] });
expect(first.metrics.effectiveDamage).toBeGreaterThan(0);
expect(first.metrics.priorityTargetDamage).toBe(first.metrics.effectiveDamage);
expect(first.metrics.castsCompleted).toBeGreaterThan(0);
expect(first.eventCounts.damage).toBeGreaterThan(0);
}, 60_000);
it("treats avoided reference attacks as valid tank pressure", async () => {
const [build] = await loadCanonicalBenchmarkBuilds(60, ["guardian"]);
const scenario = benchmarkScenarioById("tank-mixed-boss")!;
const report = await runCombatBenchmark(build, scenario, { seed: 1, durationScale: 0.1 });
expect(report.validation).toEqual({ valid: true, reasons: [] });
expect(report.metrics.incomingAttacks).toBeGreaterThan(0);
expect(report.metrics.avoidedAttacks).toBeGreaterThan(0);
expect(report.metrics.avoidancePercent).toBeGreaterThan(0);
}, 60_000);
it("keeps benchmark bosses attacking through player hard control", async () => {
const [build] = await loadCanonicalBenchmarkBuilds(60, ["starcaller"]);
const scenario = benchmarkScenarioById("tank-mixed-boss")!;
const report = await runCombatBenchmark(build, scenario, { seed: 1, durationScale: 0.1 });
expect(report.validation).toEqual({ valid: true, reasons: [] });
expect(report.metrics.incomingAttacks).toBeGreaterThan(0);
}, 60_000);
});