mirror of
https://github.com/efiten/coredrive-rx.git
synced 2026-11-23 21:07:59 +00:00
- src/hexgrid.js: JS port of the server hex grid (same cells as the analyzer) - src/localmap.js: Leaflet map aggregating this session's receptions into live hexes (best SNR colour); follows GPS with zoom preserved, drag to inspect + 📍 button to re-follow; hexes persist until reload - wired into the capture flow; Leaflet via CDN Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
23 lines
759 B
JavaScript
23 lines
759 B
JavaScript
import { test } from 'node:test';
|
|
import assert from 'node:assert';
|
|
import { hexCellAt, hexBoundary, hexResForZoom } from '../src/hexgrid.js';
|
|
|
|
test('hexCellAt is stable and distinct', () => {
|
|
const a = hexCellAt(51.05, 3.72, 9);
|
|
assert.strictEqual(a, hexCellAt(51.05, 3.72, 9));
|
|
assert.notStrictEqual(hexCellAt(51.20, 3.72, 9), a); // ~17 km away
|
|
});
|
|
|
|
test('hexBoundary is a closed 7-point ring', () => {
|
|
const r = hexBoundary(hexCellAt(51.05, 3.72, 9));
|
|
assert.strictEqual(r.length, 7);
|
|
assert.deepStrictEqual(r[0], r[6]);
|
|
assert.strictEqual(hexBoundary('garbage'), null);
|
|
});
|
|
|
|
test('hexResForZoom', () => {
|
|
assert.strictEqual(hexResForZoom(16), 11);
|
|
assert.strictEqual(hexResForZoom(8), 7);
|
|
assert.strictEqual(hexResForZoom(3), 6);
|
|
});
|