import { describe, expect, it } from "vitest";
import { ABILITY_ORDER } from "./data";
import { HEALER_GUIDES } from "./healerGuides";
import { HEALER_CLASSES, HEALER_CLASS_ORDER } from "./healers";

describe("healer class guides", () => {
  it("covers every canonical class and ability", () => {
    expect(Object.keys(HEALER_GUIDES)).toEqual(HEALER_CLASS_ORDER);
    for (const classId of HEALER_CLASS_ORDER) {
      const guide = HEALER_GUIDES[classId];
      expect(Object.keys(guide.abilityGuides)).toEqual(ABILITY_ORDER);
      expect(guide.coreLoop).toHaveLength(3);
      for (const abilityId of ABILITY_ORDER) {
        expect(guide.abilityGuides[abilityId].useWhen.length).toBeGreaterThan(20);
        expect(guide.abilityGuides[abilityId].fieldTip.length).toBeGreaterThan(20);
        expect(guide.abilityGuides[abilityId].synergies.length).toBeGreaterThan(0);
      }
    }
  });

  it("references valid companion abilities and labels direct interactions", () => {
    for (const classId of HEALER_CLASS_ORDER) {
      const guide = HEALER_GUIDES[classId];
      let directInteractions = 0;
      for (const abilityId of ABILITY_ORDER) {
        for (const synergy of guide.abilityGuides[abilityId].synergies) {
          expect(synergy.with).not.toBe(abilityId);
          expect(HEALER_CLASSES[classId].abilities[synergy.with]).toBeDefined();
          if (synergy.kind === "mechanic") directInteractions += 1;
        }
      }
      if (classId !== "priest") expect(directInteractions).toBeGreaterThan(0);
    }
  });
});
