import { describe, expect, it } from "vitest"; import { learnedAbilityForBuild } from "./abilityCatalog"; import { COA_ABILITIES_BY_CLASS } from "./coaAbilityCatalog"; import { coaTreeEntryById } from "./coaLiveCatalog"; import type { CoaClassId } from "../app/characterCatalog"; const ACTIONS: readonly [CoaClassId, number, number, string][] = [ ["guardian", 31169, 803129, "Heavy Blow"], ["witch-doctor", 12646, 801661, "Potion Toss"], ["witch-doctor", 7128, 802710, "Splash Potion"], ["barbarian", 5744, 804414, "Decapitate"], ["ranger", 31178, 500075, "Precision Shot"], ["ranger", 29660, 801191, "Hunting Shot"], ["pyromancer", 6985, 800791, "Ignite"], ]; describe("first CoA party Talent Essence actions", () => { it.each(ACTIONS)("exposes %s node %i as a learned action", (classId, nodeId, spellId, name) => { expect(coaTreeEntryById(nodeId)?.entryType).toBe("Talent"); const action = COA_ABILITIES_BY_CLASS[classId].find((ability) => ability.talentEntryId === nodeId); expect(action).toMatchObject({ name, dbcSpellId: spellId, passive: false, source: "coa-tree" }); expect(learnedAbilityForBuild(action!, 60, {})).toBeNull(); expect(learnedAbilityForBuild(action!, 60, { [`coa-entry-${nodeId}`]: 1 })) .toMatchObject({ name, dbcSpellId: spellId }); }); it("retains Potion Toss's sourced friendly heal instead of making it a damage action", () => { const toss = COA_ABILITIES_BY_CLASS["witch-doctor"].find((ability) => ability.talentEntryId === 12646)!; expect(toss.target).toBe("friendly"); expect(toss.effects.some((effect) => effect.kind === "heal")).toBe(true); expect(toss.effects.some((effect) => effect.kind === "damage")).toBe(false); }); it("keeps passive Talent nodes on their existing modifier path", () => { expect(COA_ABILITIES_BY_CLASS.barbarian.some((ability) => ability.talentEntryId === 6744)).toBe(false); expect(COA_ABILITIES_BY_CLASS["witch-doctor"].some((ability) => ability.talentEntryId === 30884)).toBe(false); }); it("leaves the other CoA classes' Talent action adoption for later milestones", () => { for (const [classId, abilities] of Object.entries(COA_ABILITIES_BY_CLASS)) { if (["guardian", "witch-doctor", "barbarian", "ranger", "pyromancer"].includes(classId)) continue; expect(abilities.some((ability) => ability.talentEntryId !== undefined && coaTreeEntryById(ability.talentEntryId)?.entryType === "Talent"), classId).toBe(false); } }); });