import { describe, expect, it } from "vitest"; import { abilitiesForCharacter, learnedAbilityForBuild } from "./abilityCatalog"; import { romRogueChaosDaggerDamage } from "./romRogueChaosDagger"; import { ROM_ROGUE_MAGE_CHAOS_DAGGER_TAG } from "./romRogueChaosDagger"; const baseInput = { classId: "rom-rogue", secondaryClassId: "rom-mage", passiveLearned: true, isAutoAttack: true, attackLanded: true, weaponHand: "main-hand" as const, weaponDps: 100, }; describe("current CoA Rogue/Mage Chaos Dagger", () => { it("replaces the same-ID RuneWaker skill with the learned CoA passive and tooltip", () => { const abilities = abilitiesForCharacter("rom-rogue", "rom-mage"); const chaosDagger = abilities.find((ability) => ability.dbcSpellId === 491178); expect(chaosDagger).toMatchObject({ name: "Chaos Dagger", passive: true, target: "self", castTimeMs: 0, cooldownMs: 0, cost: { resource: "mana", amount: 0 }, costs: [], }); expect(chaosDagger?.description).toContain("169.4% of the attacking hand's weapon DPS"); expect(chaosDagger?.description).toContain("amount or duration"); expect(chaosDagger?.effects).toContainEqual(expect.objectContaining({ kind: "apply-aura", aura: expect.objectContaining({ name: "Chaos Dagger", utilityTags: [ROM_ROGUE_MAGE_CHAOS_DAGGER_TAG], }), })); expect(learnedAbilityForBuild(chaosDagger!, 14, {})).toBeNull(); expect(learnedAbilityForBuild(chaosDagger!, 15, {})).not.toBeNull(); expect(abilitiesForCharacter("rom-rogue", "rom-priest") .some((ability) => ability.dbcSpellId === 491178)).toBe(false); }); it("uses 169.4% of the weapon DPS for the hand that made the landed normal attack", () => { expect(romRogueChaosDaggerDamage(baseInput)).toEqual({ amount: 169.4, school: "fire", weaponHand: "main-hand", }); expect(romRogueChaosDaggerDamage({ ...baseInput, weaponHand: "off-hand", weaponDps: 64.25, })).toEqual({ amount: 108.8395, school: "fire", weaponHand: "off-hand", }); }); it.each([ ["wrong primary class", { classId: "rom-scout" }], ["wrong secondary class", { secondaryClassId: "rom-priest" }], ["passive not learned", { passiveLearned: false }], ["not an autoattack", { isAutoAttack: false }], ["attack missed", { attackLanded: false }], ["zero weapon DPS", { weaponDps: 0 }], ["invalid weapon DPS", { weaponDps: Number.NaN }], ] as const)("does not add a packet for %s", (_label, override) => { expect(romRogueChaosDaggerDamage({ ...baseInput, ...override })).toBeNull(); }); });