forked from phenom/healer-man
47 lines
1.6 KiB
TypeScript
47 lines
1.6 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { PLAYER_AGGRO_ID } from "../game/aggro";
|
|
import type { ActiveAura, AuraDefinition } from "../game/combatAuras";
|
|
import { auraDisplaysInPlayerStatusPanel } from "./auraDisplay";
|
|
|
|
function activeAura(
|
|
targetId: string,
|
|
durationMs: number | null,
|
|
expiresAt: number | null = durationMs === null ? null : 10_000 + durationMs,
|
|
hideFromAuraStrip = false,
|
|
): ActiveAura {
|
|
const definition: AuraDefinition = {
|
|
id: `aura-${targetId}`,
|
|
name: "Test Aura",
|
|
disposition: "buff",
|
|
durationMs,
|
|
...(hideFromAuraStrip ? { hideFromAuraStrip: true } : {}),
|
|
};
|
|
return {
|
|
instanceId: `instance-${targetId}`,
|
|
definition,
|
|
sourceId: PLAYER_AGGRO_ID,
|
|
targetId,
|
|
appliedAt: 10_000,
|
|
expiresAt,
|
|
stacks: 1,
|
|
absorbs: [],
|
|
procStates: [],
|
|
};
|
|
}
|
|
|
|
describe("top-right status visibility", () => {
|
|
const now = 20_000;
|
|
|
|
it("shows every active player aura without including party-member copies", () => {
|
|
expect(auraDisplaysInPlayerStatusPanel(activeAura(PLAYER_AGGRO_ID, 15_000), now)).toBe(true);
|
|
expect(auraDisplaysInPlayerStatusPanel(activeAura("party-1", 60_000), now)).toBe(false);
|
|
expect(auraDisplaysInPlayerStatusPanel(activeAura("party-1", null), now)).toBe(false);
|
|
});
|
|
|
|
it("rejects unrelated, hidden, or expired auras", () => {
|
|
expect(auraDisplaysInPlayerStatusPanel(activeAura("stranger", 60_000), now)).toBe(false);
|
|
expect(auraDisplaysInPlayerStatusPanel(activeAura(PLAYER_AGGRO_ID, 60_000, 70_000, true), now)).toBe(false);
|
|
expect(auraDisplaysInPlayerStatusPanel(activeAura(PLAYER_AGGRO_ID, 5_000, 15_000), now)).toBe(false);
|
|
});
|
|
});
|