import { createElement } from "react"; import { renderToStaticMarkup } from "react-dom/server"; import { describe, expect, it } from "vitest"; import { requireDungeonDefinition } from "../game/dungeonRegistry"; import { DungeonMapGraphic } from "./DungeonMapGraphic"; function render(id: string, options: { compact?: boolean; showPatrols?: boolean; floorLevel?: number } = {}) { const dungeon = requireDungeonDefinition(id); return renderToStaticMarkup(createElement(DungeonMapGraphic, { dungeonId: id, position: dungeon.entrance.footPosition, yaw: 0, ...options })); } describe("dungeon map artwork", () => { it("renders authentic Wailing Caverns artwork and player/entrance/numbered encounters", () => { const html = render("wailing-caverns"); expect(html).toContain("wailing-caverns/maps/floor-1.png"); expect(html).toContain('viewBox="0 0 1002 668"'); expect(html).toContain("map-player"); expect(html).toContain("Dungeon entrance"); expect(html).toContain("Lady Anacondra"); expect(html).toContain("map-marker-label"); expect(html).not.toContain("map-contour"); expect(html).not.toContain("map-patrol"); }); it("keeps the compact map clear of labels and patrols", () => { const html = render("wailing-caverns", { compact: true, showPatrols: true }); expect(html).toContain("original game map"); expect(html).not.toContain("map-marker-label"); expect(html).not.toContain("map-patrol"); }); it("shows explicitly selected floor artwork", () => { expect(render("deadmines", { floorLevel: 2 })).toContain("deadmines/maps/floor-2.png"); }); it("shows original RuneWaker artwork with live markers", () => { const html = render("forsaken-abbey"); expect(html).toContain('viewBox="0 0 1002 668"'); expect(html).toContain("forsaken-abbey/maps/runewaker-map.png"); expect(html).toContain("map-player"); expect(html).toContain("Dungeon entrance"); }); it("uses a calibrated navigation floorplan when the client has no usable artwork", () => { const html = render("demon-stronghold"); expect(html).toContain("demon-stronghold/maps/runewaker-map.png"); expect(html).toContain("map-player"); }); it("only draws patrol overlays on request", () => { expect(render("wailing-caverns", { showPatrols: true })).toContain("map-patrol"); }); });