import { describe, expect, it } from "vitest";
import {
  BOSS_INDICATOR_DEATH_FADE_MS,
  advanceBossIndicatorOpacity,
  bossCanTrackTarget,
} from "./bossDeathVisuals";

describe("boss death visuals", () => {
  it("stops target tracking as soon as boss health reaches zero", () => {
    expect(bossCanTrackTarget(1)).toBe(true);
    expect(bossCanTrackTarget(0)).toBe(false);
    expect(bossCanTrackTarget(-1)).toBe(false);
  });

  it("fades mechanic indicators to zero over the death transition", () => {
    const halfway = advanceBossIndicatorOpacity(1, true, BOSS_INDICATOR_DEATH_FADE_MS / 2_000);
    expect(halfway).toBeCloseTo(0.5);
    expect(advanceBossIndicatorOpacity(halfway, true, BOSS_INDICATOR_DEATH_FADE_MS / 2_000)).toBe(0);
    expect(advanceBossIndicatorOpacity(0.4, false, 1 / 60)).toBe(1);
  });
});
