docs: address review scope and feature placement for #1032

This commit is contained in:
Rudy Celekli committed 2026-10-14 14:17:56 -04:00
1 parent ba58a5ec50
commit f67888be00
3 files changed
+25 -16

No files matched your search

@@ -1,15 +1,22 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { tilesForBbox } from './tileMath.js';
test('coarse dateline coverage counts each tile exactly once', () => {
for (const z of [0, 1, 2]) {
const result = tilesForBbox([170, -1, -170, 1], z);
const keys = result.tiles.map((t) => `${t.x}/${t.y}/${t.z}`);
assert.equal(new Set(keys).size, keys.length);
assert.equal(result.total, keys.length);
const limited = tilesForBbox([170, -1, -170, 1], z, { limit: 1 });
assert.equal(limited.total, keys.length);
assert.equal(limited.truncated, keys.length > 1);
assert.equal(limited.tiles.length, 1);
}
test('reachable polar dateline coverage ranks 24 distinct tiles before overview truncation', () => {
// coverage uses the actual view bbox above zoom 1; polar views can wrap.
const bbox = [-10, 60, -20, 85];
const result = tilesForBbox(bbox, 3);
const keys = result.tiles.map((tile) => `${tile.x}/${tile.y}/${tile.z}`);
assert.equal(keys.length, 24);
assert.equal(new Set(keys).size, 24);
assert.equal(result.total, 24);
assert.equal(result.truncated, false);
const overview = tilesForBbox(bbox, 3, { limit: 16 });
assert.equal(overview.total, 24);
assert.equal(overview.tiles.length, 16);
assert.equal(
new Set(overview.tiles.map((tile) => `${tile.x}/${tile.y}/${tile.z}`)).size,
16,
);
assert.equal(overview.truncated, true);
});