mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 01:02:23 +00:00
Earthquakes, air quality, GNSS Integrity, fire perimeters, Prohibited & Restricted Airspace, Active Fires, S2 GhostMaps, cyclone advisories and submarine cables each have one render/display.js on the globe contract; their render/cesium* and render/navara* files go. Their discs, cells, polygons and corridors are engine.ground sets, so on Navara they come from the one ground screen pass with exact colours instead of nine hand-written classification passes and lit SDK vector layers. Cesium's look stays the reference: - Earthquake and air-quality discs have no outline (Cesium drew none on clamped ellipses); earthquake discs can now be picked on Navara too. - Perimeters, drone zones and GhostMaps polygons outline their outer ring only, as Cesium did. - GNSS cells stay out of the pick pass; cyclone cones, tracks and centres are culled by a port of Cesium's horizon occluder. - Submarine cables are one ground corridor set, as Cesium batched them; landing points, tips and stems are movers and lines. - FIRMS glows are a sprite set and its cells a ground set. The far-zoom heat raster, which no primitive draws yet, sits behind one seam, render/heatField.js, with a Cesium and a Navara backend. The shared Navara ground helpers that only these layers used go (navaraGroundCells, the cell and ground geometry, the zone renderers), as does the ground prototype script. Coupling: layer renderer lines fall from 1636/6953 to 1011/4832 (Cesium/Navara), Navara ground passes from 7 to 5, Cesium-importing files from 65 to 53, engine.extensions reads from 26 to 19.
136 lines
3.7 KiB
JavaScript
136 lines
3.7 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { createCyclonesLayer } from './index.js';
|
|
import { setLocale, t } from '../../i18n/index.js';
|
|
import { createFakeEngine } from '../../globe/testing/fakeEngine.js';
|
|
|
|
// The exact string the server sends (COVERAGE in server/providers/cyclones.js).
|
|
const SERVER_COVERAGE =
|
|
'Atlantic and eastern/central North Pacific; not worldwide cyclone coverage.';
|
|
const time = '2026-09-16T03:00:00.000Z';
|
|
const storm = {
|
|
id: 'ep152026',
|
|
name: 'Fifteen-E',
|
|
classification: 'PTC',
|
|
basin: 'EP',
|
|
position: { longitude: -125.8, latitude: 15.5 },
|
|
positionAt: time,
|
|
issuedAt: time,
|
|
advisoryNumber: '10',
|
|
windKt: 25,
|
|
pressureHpa: 1006,
|
|
geometryStatus: 'pending',
|
|
geometryAdvisoryNumber: null,
|
|
forecastPoints: [],
|
|
track: null,
|
|
cone: null,
|
|
advisoryUrl: 'https://www.nhc.noaa.gov/text/MIATCMEP5.shtml',
|
|
};
|
|
const snapshot = (storms, extra = {}) => ({
|
|
schemaVersion: 1,
|
|
storms,
|
|
unavailable: false,
|
|
stale: false,
|
|
fetchedAt: Date.parse(time),
|
|
coverage: SERVER_COVERAGE,
|
|
reason: null,
|
|
...extra,
|
|
});
|
|
function harness(feed) {
|
|
const rendering = {
|
|
async setSnapshot() {
|
|
return true;
|
|
},
|
|
setSelection() {},
|
|
getFocusSphere: () => ({ radius: 500000 }),
|
|
clear() {},
|
|
destroy() {},
|
|
getDiagnostics: () => ({ entities: 0, timerActive: false }),
|
|
};
|
|
const layer = createCyclonesLayer({
|
|
feed,
|
|
createRendering: () => rendering,
|
|
matchMedia: () => ({ matches: false }),
|
|
openLink: () => {},
|
|
});
|
|
layer.init(null, { engine: createFakeEngine() });
|
|
layer.attachShellServices({ runNavigation: (fn) => fn() });
|
|
return layer;
|
|
}
|
|
|
|
const translated = () => t(SERVER_COVERAGE);
|
|
|
|
test('es: server snapshot without storms -> coverage line in Spanish', async () => {
|
|
setLocale('es');
|
|
try {
|
|
assert.notEqual(translated(), SERVER_COVERAGE, 'es.json has a translation');
|
|
const layer = harness({ getSnapshot: async () => snapshot([]) });
|
|
layer.enable();
|
|
await layer.update();
|
|
const info = layer.getRowControls().info;
|
|
assert.ok(
|
|
info.endsWith(translated()),
|
|
`expected Spanish coverage, got:\n${info}`,
|
|
);
|
|
layer.destroy();
|
|
} finally {
|
|
setLocale('en');
|
|
}
|
|
});
|
|
|
|
test('es: server snapshot with a storm -> coverage line in Spanish', async () => {
|
|
setLocale('es');
|
|
try {
|
|
const layer = harness({ getSnapshot: async () => snapshot([storm]) });
|
|
layer.enable();
|
|
await layer.update();
|
|
const info = layer.getRowControls().info;
|
|
assert.ok(
|
|
info.endsWith(translated()),
|
|
`expected Spanish coverage, got:\n${info}`,
|
|
);
|
|
layer.destroy();
|
|
} finally {
|
|
setLocale('en');
|
|
}
|
|
});
|
|
|
|
test('es: unavailable without reason -> fallback status not the English literal', async () => {
|
|
setLocale('es');
|
|
try {
|
|
const layer = harness({
|
|
getSnapshot: async () =>
|
|
snapshot([], { unavailable: true, reason: null }),
|
|
});
|
|
layer.enable();
|
|
await layer.update();
|
|
const status = layer.getRowControls().summary.status;
|
|
assert.notEqual(
|
|
status,
|
|
'Cyclone advisories unavailable',
|
|
`fallback shown in English: ${status}`,
|
|
);
|
|
layer.destroy();
|
|
} finally {
|
|
setLocale('en');
|
|
}
|
|
});
|
|
|
|
test('en: coverage and fallback status read as before', async () => {
|
|
const layer = harness({ getSnapshot: async () => snapshot([]) });
|
|
layer.enable();
|
|
await layer.update();
|
|
assert.ok(layer.getRowControls().info.endsWith(SERVER_COVERAGE));
|
|
layer.destroy();
|
|
const down = harness({
|
|
getSnapshot: async () => snapshot([], { unavailable: true, reason: null }),
|
|
});
|
|
down.enable();
|
|
await down.update();
|
|
assert.equal(
|
|
down.getRowControls().summary.status,
|
|
'Cyclone advisories unavailable',
|
|
);
|
|
down.destroy();
|
|
});
|