Files
healer-man/src/game/specializationCatalog.test.ts
T

60 lines
2.9 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { CLASSES } from "../app/characterCatalog";
import {
SPECIALIZATION_DEFINITIONS,
specializationById,
specializationIconUrl,
specializationsForClass,
romGearProfile,
} from "./specializationCatalog";
describe("specialization registry", () => {
it("covers every classic and CoA specialization with stable unique IDs", () => {
expect(new Set(SPECIALIZATION_DEFINITIONS.map((definition) => definition.id)).size)
.toBe(SPECIALIZATION_DEFINITIONS.length);
for (const characterClass of CLASSES.filter((definition) => definition.mode !== "rom")) {
const actual = specializationsForClass(characterClass.id).map((definition) => definition.displayName);
const expected = characterClass.id === "druid"
? ["Balance", "Feral (Bear)", "Feral (Cat)", "Restoration"]
: [...characterClass.specializations];
expect(actual, characterClass.name).toEqual(expect.arrayContaining(expected));
expect(actual, characterClass.name).toHaveLength(expected.length);
}
});
it("links both Feral variants to Feral Combat with distinct runtime roles", () => {
const bear = specializationById("druid:feral-bear");
const cat = specializationById("druid:feral-cat");
expect(bear).toMatchObject({ role: "tank", talentTree: "Feral Combat" });
expect(cat).toMatchObject({ role: "damage", talentTree: "Feral Combat" });
});
it("authors CoA support-oriented specializations into the three-role runtime", () => {
const coa = SPECIALIZATION_DEFINITIONS.filter((definition) => (
CLASSES.find((entry) => entry.id === definition.classId)?.mode === "conquest"
));
expect(coa.length).toBeGreaterThan(60);
expect(coa.every((definition) => ["tank", "healer", "damage"].includes(definition.role))).toBe(true);
expect(specializationById("barbarian:ancestry")?.role).toBe("damage");
});
it("uses dedicated classic spec icons with safe class-icon fallbacks", () => {
expect(specializationIconUrl("priest", "priest:holy"))
.toBe("/assets/ui/talents/icons/spell_holy_guardianspirit.png");
expect(specializationIconUrl("druid", "druid:feral-cat"))
.toBe("/assets/ui/talents/icons/ability_racial_bearform.png");
expect(specializationIconUrl("barbarian", "barbarian:ancestry"))
.toBe("/assets/ui/spells/classicon128_barbarian.png");
expect(specializationIconUrl("priest", "mage:frost"))
.toBe("/assets/ui/spells/classicon128_priest.png");
});
it("gives the five RoM primary roles their appropriate weapon layouts", () => {
expect(romGearProfile("rom-priest", "healer").weaponLayout).toBe("weapon-shield");
expect(romGearProfile("rom-knight", "tank").weaponLayout).toBe("weapon-shield");
expect(romGearProfile("rom-scout", "damage").weaponLayout).toBe("ranged");
expect(romGearProfile("rom-rogue", "damage").weaponLayout).toBe("dual-wield");
expect(romGearProfile("rom-mage", "damage").weaponLayout).toBe("two-hand");
});
});