import test from "node:test"; import assert from "node:assert/strict"; import { natureNoise01, perlin2, NATURE_TINT, NATURE_NOISE_SIZE } from "../../shared/render/natureNoise.js"; import { CHUNK_SIZE } from "../../shared/protocol/constants.js"; test("nature noise is continuous across chunk borders", () => { const scale = NATURE_TINT.scale; 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, NATURE_TINT.scale); assert.ok(n >= 0 && n <= 1); }); test("nature noise texture includes a one-tile halo", () => { assert.equal(NATURE_NOISE_SIZE, CHUNK_SIZE + 2); });