60 lines
2.4 KiB
TypeScript
60 lines
2.4 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { COA_ABILITIES_BY_CLASS } from "./coaAbilityCatalog";
|
|
import { coaSpellById } from "./coaLiveCatalog";
|
|
|
|
const expectedTrainerActions = [
|
|
{ spellId: 800317, level: 4, marker: "coa:800317:effect:0:aura:87", markerAura: 87 },
|
|
{ spellId: 803130, level: 20, marker: "coa:803130:effect:0:aura:232", markerAura: 232 },
|
|
] as const;
|
|
|
|
describe("Guardian rankless trainer actions", () => {
|
|
it("exposes only the two sourced formations with self-owned raw aura markers", () => {
|
|
const guardianAbilities = COA_ABILITIES_BY_CLASS.guardian;
|
|
const expectedIds = new Set<number>(expectedTrainerActions.map(({ spellId }) => spellId));
|
|
const actions = guardianAbilities.filter((ability) => expectedIds.has(ability.dbcSpellId));
|
|
|
|
expect(actions.map(({ dbcSpellId }) => dbcSpellId).sort()).toEqual([...expectedIds].sort());
|
|
for (const expected of expectedTrainerActions) {
|
|
const ability = actions.find(({ dbcSpellId }) => dbcSpellId === expected.spellId)!;
|
|
const source = coaSpellById(expected.spellId)!;
|
|
const marker = ability.effects.find((effect) => effect.kind === "apply-aura"
|
|
&& effect.aura.id === expected.marker);
|
|
|
|
expect(source.classIds).toContain(18);
|
|
expect(source.sourceIds).toContain(6);
|
|
expect(source.level).toBe(expected.level);
|
|
expect(source.rank).toBe("");
|
|
expect(ability).toMatchObject({
|
|
id: `coa-trainer-${expected.spellId}`,
|
|
classId: "guardian",
|
|
dbcSpellId: expected.spellId,
|
|
unlockLevel: expected.level,
|
|
target: "self",
|
|
castMode: "instant",
|
|
castTimeMs: 0,
|
|
cooldownMs: 0,
|
|
gcdMs: 0,
|
|
cost: { resource: "energy", amount: 20 },
|
|
passive: false,
|
|
source: "coa-progression",
|
|
});
|
|
expect(ability.ranks).toHaveLength(1);
|
|
expect(ability.ranks?.[0]).toMatchObject({ spellId: expected.spellId, rank: 1, level: expected.level });
|
|
expect(marker).toMatchObject({
|
|
kind: "apply-aura",
|
|
recipient: "caster",
|
|
sourceEffectType: 6,
|
|
sourceAuraType: expected.markerAura,
|
|
});
|
|
}
|
|
|
|
const learnedSpellIds = new Set(guardianAbilities.flatMap((ability) => [
|
|
ability.dbcSpellId,
|
|
...(ability.ranks ?? []).map(({ spellId }) => spellId),
|
|
]));
|
|
for (const helperSpellId of [803151, 803690, 803907, 803941]) {
|
|
expect(learnedSpellIds.has(helperSpellId)).toBe(false);
|
|
}
|
|
});
|
|
});
|