import { describe, expect, it } from "vitest"; import type { ClassId, RaceId } from "../app/characterCatalog"; import fixture from "./generated/characterStatRulesetCompatibility.json"; import type { ItemStats } from "./itemStats"; import { deriveCharacterStats } from "./wotlkStats"; describe("saved-character stat compatibility", () => { for (const row of fixture.rows) { it(`preserves frozen ${row.classId} level ${row.level} stats with and without an explicit WoW profile`, () => { const args = [ row.classId as ClassId, row.level, fixture.gear as ItemStats, row.raceId as RaceId, fixture.modifiers, row.secondaryClassId as ClassId | null, ] as const; for (const stats of [ deriveCharacterStats(...args), deriveCharacterStats(...args, undefined, "wow"), ]) { // Compare the pre-existing outputs; extra ruleset metadata may be added. expect(Object.fromEntries(Object.keys(row.expected).map((key) => [ key, stats[key as keyof typeof stats], ]))).toEqual(row.expected); } }); } });