Files
gods-eye-view/src/maps/imageryHost.test.mjs
T
Bilawal Sidhuandmanjunath22466 082074a006 feat(layers): Recent Imagery — open satellite imagery for a selected box (#716)
Select a box on the world and browse the last 30 days of open satellite imagery over it, keyless: NASA GIBS Harmonized Landsat Sentinel-2 (30 m) and the VIIRS daily overview (250 m), with a day strip, IMAGE / VS BASEMAP / A / B modes with a swipe divider, PNG export and share links. The before/after swipe from the Nepal scene moves into shared modules so both use it.

Co-authored-by: manjunath22466 <[email protected]>
2026-09-22 20:34:11 -05:00

41 lines
1.4 KiB
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import { NO_IMAGERY_HOST, resolveImageryHost } from './imageryHost.js';
test('a shown globe hosts imagery on the viewer collection', () => {
const imageryLayers = { id: 'globe' };
const host = resolveImageryHost({
viewer: { scene: { globe: { show: true } }, imageryLayers },
tileset: { imageryLayers: { id: 'tiles' } },
});
assert.deepEqual(host, { collection: imageryLayers, kind: 'globe' });
});
test('a hidden globe hands imagery to the tileset collection', () => {
const imageryLayers = { id: 'tiles' };
const host = resolveImageryHost({
viewer: { scene: { globe: { show: false } }, imageryLayers: {} },
tileset: { imageryLayers, isDestroyed: () => false },
});
assert.deepEqual(host, { collection: imageryLayers, kind: 'tileset' });
});
test('no globe and no tileset means nowhere to drape', () => {
assert.deepEqual(
resolveImageryHost({
viewer: { scene: { globe: { show: false } }, imageryLayers: {} },
tileset: null,
}),
{ collection: null, kind: 'none' },
);
assert.deepEqual(resolveImageryHost({}), { collection: null, kind: 'none' });
assert.deepEqual(
resolveImageryHost({
viewer: { scene: { globe: { show: false } } },
tileset: { imageryLayers: {}, isDestroyed: () => true },
}),
{ collection: null, kind: 'none' },
);
assert.match(NO_IMAGERY_HOST, /globe map/);
});