Render textured aerial maps and support legacy recovery links
This commit is contained in:
14
tests/legacy-recovery.test.ts
Normal file
14
tests/legacy-recovery.test.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { legacyRecoveryToken } from "../shared/legacy-recovery";
|
||||
|
||||
test("legacy recovery email path yields only its code segment", () => {
|
||||
assert.equal(legacyRecoveryToken("/code=abc12345-6789"), "abc12345-6789");
|
||||
for (const path of [
|
||||
"/code=short",
|
||||
"/code=abc12345/other",
|
||||
"/code=abc%2F12345",
|
||||
"/auth/callback",
|
||||
])
|
||||
assert.equal(legacyRecoveryToken(path), null);
|
||||
});
|
||||
18
tests/map-view.test.ts
Normal file
18
tests/map-view.test.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
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/,
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user