import test from "node:test"; import assert from "node:assert/strict"; import { natureNoise01, perlin2 } from "../../shared/render/natureNoise.js"; import { CHUNK_SIZE } from "../../shared/protocol/constants.js"; test("nature noise is continuous across chunk borders", () => { const scale = 0.08; const a = natureNoise01(CHUNK_SIZE - 1, 5, scale); const b = natureNoise01(CHUNK_SIZE, 5, scale); assert.ok(Math.abs(a - b) < 0.25, `border jump too large: ${a} vs ${b}`); }); test("perlin is deterministic and bounded", () => { assert.equal(perlin2(1.5, 2.5), perlin2(1.5, 2.5)); const n = natureNoise01(12, 34, 0.1); assert.ok(n >= 0 && n <= 1); });