Files
healer-man/src/game/manastormMapPipeline.test.ts
T
2026-08-14 15:56:39 -04:00

44 lines
1.8 KiB
TypeScript

import { readFile, readdir } from "node:fs/promises";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { describe, expect, it } from "vitest";
import epochInstances from "../../dungeon-pipeline/epoch-five-player-instances.json";
const projectRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
const workRoot = path.join(projectRoot, "dungeon-pipeline/manastorm");
describe("Manastorm map conversion scaffold", () => {
it("discovers extracted terrain for the installed Manastorm and Project Epoch maps", async () => {
const snapshot = JSON.parse(await readFile(
path.join(workRoot, "source-snapshot.json"),
"utf8",
));
const expectedMaps = 73 + epochInstances.dungeons.length;
expect(snapshot.counts).toEqual({
maps: expectedMaps,
sourceFound: expectedMaps,
sourceMissing: 0,
});
expect(snapshot.maps.every((map: { sources: unknown[] }) => map.sources.length > 0)).toBe(true);
});
it("creates a distinct visual, collision, and navigation shipping recipe per map", async () => {
const files = (await readdir(path.join(workRoot, "recipes")))
.filter((file) => file.endsWith(".json"));
expect(files).toHaveLength(73 + epochInstances.dungeons.length);
for (const file of files) {
const recipe = JSON.parse(await readFile(path.join(workRoot, "recipes", file), "utf8"));
expect(recipe.shipping).toEqual({
visual: `${recipe.slug}/visual.glb`,
collision: `${recipe.slug}/collision.glb`,
navigation: `${recipe.slug}/navigation.glb`,
});
if (recipe.clientSnapshot === "project-epoch-installed-client") {
expect(recipe.sourceCandidates).toEqual([]);
} else {
expect(recipe.sourceCandidates.length).toBeGreaterThan(0);
}
}
});
});