All checks were successful
Deploy MineGeo to Dokploy / deploy (push) Successful in 6m26s
18 lines
1.3 KiB
TypeScript
18 lines
1.3 KiB
TypeScript
import { test } from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { datasetSchema, usesTerrainRenderer } from "../shared/protocol";
|
|
|
|
test("Fabric terrain uses the standalone renderer; older captures and imports keep image processing", () => {
|
|
const asset = (path: string) => ({ path, bytes: 1, sha256: "a".repeat(64) });
|
|
const points = Array.from({ length: 5 }, (_, i) => ({ id: `p${i}`, x: i, y: 65, z: i }));
|
|
const common = { format: "minegeo-dataset/v1", minecraftVersion: "1.21.11", dimension: "minecraft:overworld", source: "fabric", name: "Example", serverName: "Example", north: "-z", bounds: { minX: 0, minZ: 0, maxX: 64, maxZ: 64 }, viewpoints: points };
|
|
const faces = ["px", "nx", "py", "ny", "pz", "nz"];
|
|
const pngAssets = [asset("map.png"), ...points.flatMap(p => faces.map(f => asset(`${p.id}/${f}.png`)))];
|
|
const old = datasetSchema.parse({ ...common, assets: pngAssets });
|
|
const terrain = datasetSchema.parse({ ...common, assets: [...pngAssets, asset("terrain.json.gz")] });
|
|
const imported = datasetSchema.parse({ ...common, mediaFormat: "webp", assets: [asset("map.webp"), ...points.flatMap(p => faces.map(f => asset(`${p.id}/${f}.webp`)))] });
|
|
assert.equal(usesTerrainRenderer(old), false);
|
|
assert.equal(usesTerrainRenderer(terrain), true);
|
|
assert.equal(usesTerrainRenderer(imported), false);
|
|
});
|