mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 10:24:02 +00:00
Traffic roads come from OpenFreeMap vector tiles, or TomTom flow tiles with a key (Hybrid by default). Military areas use OpenFreeMap polygons with a bundled worldwide name index; wide views show named points. ALPR reads an hourly OpenStreetMap extract. Cockpit place context and country, state and US county outlines use bundled Natural Earth and US Census data. Overpass is used only when an operator configures their own endpoint. Also: camera arrivals no longer land below ground, keyless terrain retries on 429, bounded relation geometry for configured Overpass, one shared OpenStreetMap credit, and separate tile and API transports for embedders. Co-authored-by: theGaryLarson <[email protected]> Co-authored-by: Milan Khanal <[email protected]>
35 lines
1.9 KiB
JavaScript
35 lines
1.9 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { installationFeedback } from './installationFeedback.js';
|
|
|
|
test('retry copy follows the real deadline and does not promise an overdue timer fired', () => {
|
|
assert.equal(installationFeedback({ retryAt: 31000 }, 1000), 'Overpass temporarily unavailable — retrying in 30s');
|
|
assert.match(installationFeedback({ retryAt: 31000 }, 32000), /retry pending$/);
|
|
assert.match(installationFeedback({ retryAt: 241000 }, 1000), /240s$/);
|
|
});
|
|
test('only known failure reasons get specific attribution', () => {
|
|
for (const [failureReason, text] of [['rate_limited', 'rate-limited'], ['timeout', 'timed out'], ['query_failed', 'could not complete']]) {
|
|
assert.ok(installationFeedback({ status: 'unavailable', failureReason }).includes(text));
|
|
}
|
|
assert.match(installationFeedback({ status: 'unavailable', failureReason: 'unknown' }), /temporarily unavailable/);
|
|
});
|
|
test('first fetch, retry, cached data and success have distinct copy', () => {
|
|
assert.equal(installationFeedback({ loading: true }), 'Fetching mapped sites…');
|
|
assert.equal(installationFeedback({ loading: true, retrying: true }), 'Retrying mapped sites…');
|
|
assert.equal(installationFeedback({ status: 'ready' }), 'Mapped sites loaded');
|
|
assert.equal(installationFeedback({ stale: true }), 'Showing cached mapped sites');
|
|
});
|
|
test('a counted result names what was found and where', () => {
|
|
assert.equal(installationFeedback({ status: 'ready', count: 3 }), '3 mapped sites in view');
|
|
assert.equal(installationFeedback({ status: 'empty', count: 0 }), 'No mapped sites in view');
|
|
const coverage = { kind: 'subject', radiusM: 100_000 };
|
|
assert.equal(
|
|
installationFeedback({ status: 'ready', count: 1, coverage }),
|
|
'1 mapped site within 100 km of the contact',
|
|
);
|
|
assert.equal(
|
|
installationFeedback({ status: 'unavailable', failureReason: 'tiles_unavailable' }),
|
|
'Map tiles temporarily unavailable',
|
|
);
|
|
});
|