mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 18:34:02 +00:00
The first formal release. - One-click install via Pinokio; keyless boot lands on a live Esri World Imagery satellite globe with keyless terrain, with automatic OSM fallback and graceful degradation when terrain is unavailable. - Provider Settings (the POWER UP panel): add, replace, or remove API keys inside the app; credential files made owner-only before any secret is written; external keys shown read-only; the panel refuses shared or proxied servers. - Keyless capability responses for the optional HUD summary and place search. - Aircraft-identity voice answers cover operator, type, and route, and say so plainly when enrichment is unavailable. - README rewritten keyless-first; concise 0.1.0 changelog section; CI workflow included. Gates: 2,672 unit tests pass / 0 fail, build clean, tracking regression 108/108, map-source tray QA pass, setup doctor ready.
105 lines
3.8 KiB
JavaScript
105 lines
3.8 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import {
|
|
loadPhotorealisticTileset,
|
|
selectMapStartupRoute,
|
|
} from './mapStartup.js';
|
|
|
|
function fakeCesium(outcomes = []) {
|
|
const calls = [];
|
|
return {
|
|
calls,
|
|
Ion: { defaultAccessToken: undefined },
|
|
GoogleMaps: { defaultApiKey: undefined },
|
|
async createGooglePhotorealistic3DTileset(options) {
|
|
calls.push({
|
|
options,
|
|
googleKey: this.GoogleMaps.defaultApiKey,
|
|
ionToken: this.Ion.defaultAccessToken,
|
|
});
|
|
const outcome = outcomes.shift();
|
|
if (outcome instanceof Error) throw outcome;
|
|
return outcome;
|
|
},
|
|
};
|
|
}
|
|
|
|
test('map startup route reflects the best configured provider', () => {
|
|
assert.equal(selectMapStartupRoute({ googleApiKey: 'google', cesiumToken: 'ion' }), 'google-direct');
|
|
assert.equal(selectMapStartupRoute({ cesiumToken: 'ion' }), 'google-ion');
|
|
assert.equal(selectMapStartupRoute(), 'osm');
|
|
});
|
|
|
|
test('no credentials skip photoreal loading and preserve keyless startup', async () => {
|
|
const Cesium = fakeCesium();
|
|
const result = await loadPhotorealisticTileset(Cesium);
|
|
assert.equal(result.tileset, null);
|
|
assert.equal(result.route, 'osm');
|
|
assert.equal(Cesium.calls.length, 0);
|
|
});
|
|
|
|
test('a direct Google key is preferred', async () => {
|
|
const tileset = { id: 'direct' };
|
|
const Cesium = fakeCesium([tileset]);
|
|
const result = await loadPhotorealisticTileset(Cesium, {
|
|
googleApiKey: 'google-secret',
|
|
cesiumToken: 'ion-secret',
|
|
});
|
|
assert.equal(result.tileset, tileset);
|
|
assert.equal(result.route, 'google-direct');
|
|
assert.equal(Cesium.calls[0].googleKey, 'google-secret');
|
|
});
|
|
|
|
test('an ion-only setup loads the hosted Google 3D asset', async () => {
|
|
const tileset = { id: 'ion' };
|
|
const Cesium = fakeCesium([tileset]);
|
|
const result = await loadPhotorealisticTileset(Cesium, { cesiumToken: 'ion-secret' });
|
|
assert.equal(result.tileset, tileset);
|
|
assert.equal(result.route, 'google-ion');
|
|
assert.equal(Cesium.calls.length, 1);
|
|
assert.equal(Cesium.calls[0].googleKey, undefined);
|
|
assert.equal(Cesium.calls[0].ionToken, 'ion-secret');
|
|
assert.equal(Cesium.Ion.defaultAccessToken, 'ion-secret');
|
|
});
|
|
|
|
test('a failed direct request retries through ion before falling back', async () => {
|
|
const tileset = { id: 'ion-fallback' };
|
|
const Cesium = fakeCesium([new Error('direct denied'), tileset]);
|
|
const result = await loadPhotorealisticTileset(Cesium, {
|
|
googleApiKey: 'google-secret',
|
|
cesiumToken: 'ion-secret',
|
|
});
|
|
assert.equal(result.tileset, tileset);
|
|
assert.equal(result.route, 'google-ion');
|
|
assert.equal(result.errors.length, 1);
|
|
assert.equal(Cesium.calls[0].googleKey, 'google-secret');
|
|
assert.equal(Cesium.calls[1].googleKey, undefined);
|
|
assert.equal(Cesium.calls.length, 2);
|
|
});
|
|
|
|
test('a failed direct-only request does not consume an implicit Cesium token', async () => {
|
|
const Cesium = fakeCesium([new Error('direct denied')]);
|
|
const result = await loadPhotorealisticTileset(Cesium, {
|
|
googleApiKey: 'google-secret',
|
|
});
|
|
assert.equal(result.tileset, null);
|
|
assert.equal(result.route, 'osm');
|
|
assert.equal(result.errors.length, 1);
|
|
assert.equal(Cesium.calls.length, 1);
|
|
assert.equal(Cesium.calls[0].googleKey, 'google-secret');
|
|
assert.equal(Cesium.GoogleMaps.defaultApiKey, undefined);
|
|
});
|
|
|
|
test('failed direct and ion requests preserve the keyless OSM fallback', async () => {
|
|
const Cesium = fakeCesium([new Error('direct denied'), new Error('ion denied')]);
|
|
const result = await loadPhotorealisticTileset(Cesium, {
|
|
googleApiKey: 'google-secret',
|
|
cesiumToken: 'ion-secret',
|
|
});
|
|
assert.equal(result.tileset, null);
|
|
assert.equal(result.route, 'osm');
|
|
assert.equal(result.errors.length, 2);
|
|
assert.equal(Cesium.calls.length, 2);
|
|
assert.equal(Cesium.GoogleMaps.defaultApiKey, undefined);
|
|
});
|