import { describe, expect, it } from "vitest"; import { activeEncounterSpawnGroupSpawns, suppressCompletedDungeonPopulation, } from "./dungeonEncounterSpawns"; const spawn = (id: string, spawnMask: number) => ({ id, entityId: "test-mob", position: [0, 0, 0] as const, yaw: 0, spawnMask, }); describe("encounter spawn groups", () => { it("adds only active, difficulty-matching, non-duplicate runtime ids", () => { const result = activeEncounterSpawnGroupSpawns([ { id: "wave-a", spawns: [spawn("one", 1), spawn("two", 2)] }, { id: "wave-b", spawns: [spawn("three", 1)] }, ], ["wave-a"], 1, [spawn("one", 1)]); expect(result.map((entry) => entry.id)).toEqual([]); expect(activeEncounterSpawnGroupSpawns([ { id: "wave-a", spawns: [spawn("one", 1), spawn("two", 2)] }, ], ["wave-a"], 2).map((entry) => entry.id)).toEqual(["two"]); }); it("suppresses completed static and roaming boss runtime ids on checkpoint reload", () => { const result = suppressCompletedDungeonPopulation( [spawn("static-boss", 1), spawn("trash", 1)], [{ id: "boss-patrol", name: "Boss Patrol", speed: 1, formationSource: "database-solo", waypoints: [[0, 0, 0], [1, 0, 0]], members: [ { id: "boss", entityId: "test-mob", role: "leader", formationOffset: [0, 0, 0] }, { id: "escort", entityId: "test-mob", role: "follower", formationOffset: [1, 0, 0] }, ], }], ["static-boss", "boss-patrol:boss"], ); expect(result.staticSpawns.map((entry) => entry.id)).toEqual(["trash"]); expect(result.roamingPacks[0].members.map((member) => member.id)).toEqual(["escort"]); }); });