import { describe, expect, it } from "vitest";
import { PARTY_ABILITY_LOADOUTS, PARTY_ABILITY_NAMES } from "./partyCombat";
import { PARTY_ATTACK_VFX, partyAttackVfxProfile } from "./partyAttackVisuals";

describe("party attack visuals", () => {
  it("covers every party combat ability", () => {
    expect(Object.keys(PARTY_ATTACK_VFX).sort()).toEqual(Object.keys(PARTY_ABILITY_NAMES).sort());
  });

  it("keeps every profile attached to its loadout owner", () => {
    for (const [ownerId, abilityIds] of Object.entries(PARTY_ABILITY_LOADOUTS)) {
      for (const abilityId of abilityIds) {
        expect(partyAttackVfxProfile(abilityId).ownerId).toBe(ownerId);
      }
    }
  });

  it("gives every ranged attack a visible trail and every melee loadout a non-projectile style", () => {
    for (const abilityId of [...PARTY_ABILITY_LOADOUTS.nia, ...PARTY_ABILITY_LOADOUTS.orin]) {
      const profile = partyAttackVfxProfile(abilityId);
      if (profile.style === "buff") continue;
      expect(profile.style).toBe("projectile");
      expect(profile.trail).toBeGreaterThan(0);
    }
    for (const abilityId of [...PARTY_ABILITY_LOADOUTS.brann, ...PARTY_ABILITY_LOADOUTS.vale]) {
      expect(partyAttackVfxProfile(abilityId).style).not.toBe("projectile");
    }
  });
});
