Files
MineGeo/tests/map-view.test.ts

19 lines
568 B
TypeScript

import { test } from "node:test";
import assert from "node:assert/strict";
import { mapDimensions } from "../renderer/map-view.mjs";
test("aerial map pixels keep rectangular X/Z bounds square", () => {
assert.deepEqual(
mapDimensions({ minX: -32, maxX: 96, minZ: -16, maxZ: 48 }),
{ width: 1024, height: 512 },
);
assert.deepEqual(
mapDimensions({ minX: 0, maxX: 2048, minZ: 0, maxZ: 1024 }),
{ width: 2048, height: 1024 },
);
assert.throws(
() => mapDimensions({ minX: 4, maxX: 4, minZ: 0, maxZ: 16 }),
/positive integer/,
);
});