import { describe, expect, it } from "vitest"; import { DUNGEON_DEFINITIONS, requireDungeonDefinition } from "./dungeonRegistry"; import { FORSAKEN_ABBEY_DEFINITION } from "./dungeons/forsakenAbbey"; import { WOW_DUNGEON_LIGHTING, withWowDungeonEnvironment, wowDungeonLightingProfile } from "./wowDungeonEnvironment"; import stairs from "./generated/wowDungeonStairs.generated.json"; import stockadesOverride from "../../dungeon-pipeline/runtime-overrides/stormwind-stockade.json"; import { isBiteSizedDungeonId } from "./dungeonContentSource"; describe("fleet-wide WoW dungeon environment policy", () => { const wowDungeons = DUNGEON_DEFINITIONS.filter((dungeon) => ( dungeon.expansion !== "runewaker" && !isBiteSizedDungeonId(dungeon.id) )); it("gives every WoW dungeon readable ambient and hemisphere fill without changing fog draw distance or material roles", () => { expect(wowDungeons).toHaveLength(54); for (const dungeon of wowDungeons) { const profile = WOW_DUNGEON_LIGHTING[wowDungeonLightingProfile(dungeon.id)]; expect(dungeon.presentation.ambientLight).toEqual(profile.ambientLight); expect(dungeon.presentation.hemisphereLight).toEqual(profile.hemisphereLight); expect(dungeon.presentation.fog.far).toBeGreaterThan(dungeon.presentation.fog.near); const updated = withWowDungeonEnvironment(dungeon); expect(updated.presentation.materials).toBe(dungeon.presentation.materials); expect(updated.assets).toBe(dungeon.assets); expect(updated.validation).toBe(dungeon.validation); } }); it("keeps Stockades' reviewed lighting, ramps and navigation links intact", () => { const stockades = requireDungeonDefinition("stormwind-stockade"); // The existing campaign compiler stores package vectors at four decimals. const compiled = (value: unknown) => JSON.parse(JSON.stringify(value, (_key, item) => typeof item === "number" ? Number(item.toFixed(4)) : item)); expect(stockades.traversalRamps).toEqual(compiled(stockadesOverride.traversalRamps)); expect(stockades.navigationLinks).toEqual(compiled(stockadesOverride.navigationLinks)); expect(stockades.presentation.directionalLight).toEqual(stockadesOverride.presentation.directionalLight); }); it("does not apply WoW changes to RuneWaker environments", () => { expect(withWowDungeonEnvironment(FORSAKEN_ABBEY_DEFINITION)).toBe(FORSAKEN_ABBEY_DEFINITION); }); it("records a scan for every shipped WoW dungeon and installs only package-matched proxies", () => { expect(Object.keys(stairs.dungeons).sort()).toEqual(wowDungeons.map((dungeon) => dungeon.id).sort()); for (const dungeon of wowDungeons) { const record = (stairs.dungeons as Record)[dungeon.id]; if (record.ramps.length) expect(dungeon.traversalRamps).toEqual(record.ramps); } }); it("rejects stale ramp coordinates when collision content is replaced", () => { const dungeon = wowDungeons.find((entry) => entry.id !== "stormwind-stockade" && entry.traversalRamps?.length)!; expect(dungeon).toBeDefined(); const replaced = { ...dungeon, traversalRamps: undefined, assets: { ...dungeon.assets, collision: dungeon.assets.collision.map((asset) => ({ ...asset, checksum: "replacement" })) } }; expect(withWowDungeonEnvironment(replaced).traversalRamps).toBeUndefined(); }); });