import { describe, expect, it } from "vitest"; import { GRAFU_CASTLE_BOSSES, GRAFU_CASTLE_ENTITIES, GRAFU_CASTLE_POPULATION_PROVENANCE, GRAFU_CASTLE_STATIC_SPAWNS, } from "./generated/grafuCastlePopulation.generated"; const CONTROLLER_ENTITY_IDS = [ "rw-grafu-castle-105210", "rw-grafu-castle-105254", "rw-grafu-castle-105258", ] as const; const BOSS_ENTITY_IDS = [ "rw-grafu-castle-105204", "rw-grafu-castle-105224", "rw-grafu-castle-105351", "rw-grafu-castle-105542", "rw-grafu-castle-105543", "rw-grafu-castle-105616", ] as const; describe("Grafu Castle population", () => { it("does not render Lua controllers as mushroom combat mobs", () => { for (const controllerId of CONTROLLER_ENTITY_IDS) { expect(GRAFU_CASTLE_ENTITIES).not.toHaveProperty(controllerId); expect(GRAFU_CASTLE_STATIC_SPAWNS.some((spawn) => ( String(spawn.entityId) === controllerId ))).toBe(false); } }); it("materializes the source-authored patrol formations", () => { const formationSpawns = GRAFU_CASTLE_STATIC_SPAWNS.filter((spawn) => ( spawn.id.startsWith("rw-grafu-castle-scripted-castle-patrol-") )); expect(formationSpawns).toHaveLength(38); expect(new Set(formationSpawns.map((spawn) => GRAFU_CASTLE_ENTITIES[spawn.entityId]?.name))) .toEqual(new Set([ "Conjurer's Apprentice", "Cursed Steel Soldier", "Giant Enraged Bear", "Manipulated Bear", "Manipulated Steel Soldier", "Odd Castle Clown", "Smirking Castle Clown", ])); }); it("ships all five normal encounters and both members of the duo", () => { expect(GRAFU_CASTLE_BOSSES.map((boss) => boss.name)).toEqual([ "Cayus", "Ardmond and Issac", "Boro-Boro Brothers", "Conjurer Chapeaunoir", "Larvanger Barkud", ]); expect(GRAFU_CASTLE_POPULATION_PROVENANCE.bossSpawnCount).toBe(5); expect(GRAFU_CASTLE_POPULATION_PROVENANCE.scriptedSpawnCount).toBe(44); for (const entityId of BOSS_ENTITY_IDS) { expect(GRAFU_CASTLE_ENTITIES[entityId].kind).toBe("boss"); expect(GRAFU_CASTLE_ENTITIES[entityId].visual.model?.url).toMatch( /^\/assets\/creatures\/grafu-castle\/.+\.glb$/, ); expect(GRAFU_CASTLE_STATIC_SPAWNS.some((spawn) => spawn.entityId === entityId)).toBe(true); } for (const objective of GRAFU_CASTLE_BOSSES) { expect(GRAFU_CASTLE_STATIC_SPAWNS.some((spawn) => spawn.id === objective.id)).toBe(true); } }); });