mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Drape recent imagery through the renderer's globe port
The two recent imagery slots now add their GIBS layers through the globe port and share their six-request budget through its admission hook. The port moves the layers between the globe and the base tileset, which the renderer now marks as a base when it is the host. The renderer stays the layer's Cesium side: it still loads the camera factory, and now the globe factory too. The weather and wind entries load the globe factory as well, and the factory check counts callers that take findGlobe as a default.
This commit is contained in:
1 parent
76880f6eae
commit
b1733fa41a
9 files changed
+243
-250
No files matched your search
@@ -3832,6 +3832,8 @@
|
|||||||
"src/data/bhoteKoshiLocator.js",
|
"src/data/bhoteKoshiLocator.js",
|
||||||
"src/render/cesium/camera.js",
|
"src/render/cesium/camera.js",
|
||||||
"src/render/cesium/draw.js",
|
"src/render/cesium/draw.js",
|
||||||
|
"src/render/cesium/imagery.js",
|
||||||
|
"src/maps/google3d.js",
|
||||||
"src/render/cesium/cameraControls.js",
|
"src/render/cesium/cameraControls.js",
|
||||||
"src/render/cesium/follow.js",
|
"src/render/cesium/follow.js",
|
||||||
"src/data/bhoteKoshiIncidentPlaces.js",
|
"src/data/bhoteKoshiIncidentPlaces.js",
|
||||||
@@ -4322,6 +4324,7 @@
|
|||||||
"src/layers/recentImagery/model.js",
|
"src/layers/recentImagery/model.js",
|
||||||
"src/layers/recentImagery/catalog.js",
|
"src/layers/recentImagery/catalog.js",
|
||||||
"src/layers/recentImagery/rendering.js",
|
"src/layers/recentImagery/rendering.js",
|
||||||
|
"src/render/cesium/globe.js",
|
||||||
"src/layers/recentImagery/thumbnails.js",
|
"src/layers/recentImagery/thumbnails.js",
|
||||||
"src/maps/imageryHost.js",
|
"src/maps/imageryHost.js",
|
||||||
"src/layers/streetLevel/index.js",
|
"src/layers/streetLevel/index.js",
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ import {
|
|||||||
} from './model.js';
|
} from './model.js';
|
||||||
import { msg, t } from '../../i18n/index.js';
|
import { msg, t } from '../../i18n/index.js';
|
||||||
import { READOUT_WORDS, displayDay, displayMetres } from './display.js';
|
import { READOUT_WORDS, displayDay, displayMetres } from './display.js';
|
||||||
import { findCamera } from '../../render/rendererOf.js';
|
import { findCamera, findGlobe } from '../../render/rendererOf.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Quiet time after the last arrow key before the focused day previews, so a
|
* Quiet time after the last arrow key before the focused day previews, so a
|
||||||
@@ -103,13 +103,14 @@ const modeFrom = (value) =>
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the layer.
|
* Create the layer.
|
||||||
* @param {{ catalog?: { searchHls: Function }, renderer: object, thumbnails: object, host?: Function, now?: () => Date, days?: number, setTimeoutImpl?: Function, clearTimeoutImpl?: Function }} options
|
* @param {{ catalog?: { searchHls: Function }, renderer: object, thumbnails: object, host?: Function, globeOf?: Function, now?: () => Date, days?: number, setTimeoutImpl?: Function, clearTimeoutImpl?: Function }} options
|
||||||
*/
|
*/
|
||||||
export function createRecentImageryLayer({
|
export function createRecentImageryLayer({
|
||||||
catalog = { searchHls },
|
catalog = { searchHls },
|
||||||
renderer,
|
renderer,
|
||||||
thumbnails,
|
thumbnails,
|
||||||
host = resolveImageryHost,
|
host = resolveImageryHost,
|
||||||
|
globeOf = findGlobe,
|
||||||
now = () => new Date(),
|
now = () => new Date(),
|
||||||
days = CATALOG_DAYS,
|
days = CATALOG_DAYS,
|
||||||
setTimeoutImpl = (fn, ms) => globalThis.setTimeout(fn, ms),
|
setTimeoutImpl = (fn, ms) => globalThis.setTimeout(fn, ms),
|
||||||
@@ -380,7 +381,13 @@ export function createRecentImageryLayer({
|
|||||||
const changed =
|
const changed =
|
||||||
next.collection !== _hostInfo.collection || next.kind !== _hostInfo.kind;
|
next.collection !== _hostInfo.collection || next.kind !== _hostInfo.kind;
|
||||||
_hostInfo = next;
|
_hostInfo = next;
|
||||||
renderer.rebind(next);
|
// The layers drape through the viewer's globe port, on the tileset too
|
||||||
|
// when that is the host.
|
||||||
|
renderer.rebind({
|
||||||
|
...next,
|
||||||
|
globe: next.kind === 'none' ? null : globeOf(_viewer),
|
||||||
|
tileset: next.kind === 'tileset' ? _tileset : null,
|
||||||
|
});
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ function fixture({
|
|||||||
hostKind = 'globe',
|
hostKind = 'globe',
|
||||||
controller = fakeController(),
|
controller = fakeController(),
|
||||||
viirs = true,
|
viirs = true,
|
||||||
|
globeOf,
|
||||||
} = {}) {
|
} = {}) {
|
||||||
const renderer = fakeRenderer();
|
const renderer = fakeRenderer();
|
||||||
const thumbnails = fakeThumbnails();
|
const thumbnails = fakeThumbnails();
|
||||||
@@ -129,6 +130,7 @@ function fixture({
|
|||||||
collection: collections[hostState.kind],
|
collection: collections[hostState.kind],
|
||||||
kind: hostState.kind,
|
kind: hostState.kind,
|
||||||
}),
|
}),
|
||||||
|
...(globeOf && { globeOf }),
|
||||||
now: () => NOW,
|
now: () => NOW,
|
||||||
setTimeoutImpl: timers.setTimeoutImpl,
|
setTimeoutImpl: timers.setTimeoutImpl,
|
||||||
clearTimeoutImpl: timers.clearTimeoutImpl,
|
clearTimeoutImpl: timers.clearTimeoutImpl,
|
||||||
@@ -829,6 +831,32 @@ test('without a host the drapes hide and say so; the stats poll rebinds when no
|
|||||||
assert.equal(f.owned().a.kind, 'tileset');
|
assert.equal(f.owned().a.kind, 'tileset');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("the renderer is bound with the viewer's globe port, and the attached tileset while that is the host", async () => {
|
||||||
|
const globe = { name: 'globe port' };
|
||||||
|
const asked = [];
|
||||||
|
const f = fixture({
|
||||||
|
globeOf: (viewer) => {
|
||||||
|
asked.push(viewer);
|
||||||
|
return globe;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
await f.ready();
|
||||||
|
const last = () => f.renderer.hosts.at(-1);
|
||||||
|
assert.equal(last().globe, globe);
|
||||||
|
assert.equal(last().tileset, null, 'a globe host carries no tileset');
|
||||||
|
assert.ok(asked.every((viewer) => viewer === f.viewer));
|
||||||
|
const tileset = { name: 'photoreal' };
|
||||||
|
f.hostState.kind = 'tileset';
|
||||||
|
f.layer.attachTileset(tileset);
|
||||||
|
assert.equal(last().kind, 'tileset');
|
||||||
|
assert.equal(last().globe, globe);
|
||||||
|
assert.equal(last().tileset, tileset);
|
||||||
|
f.hostState.kind = 'none';
|
||||||
|
f.layer.getStats();
|
||||||
|
assert.equal(last().globe, null, 'no host, no port');
|
||||||
|
f.layer.destroy();
|
||||||
|
});
|
||||||
|
|
||||||
test('a controller subscription moves the drape to the new host on every settled switch', async () => {
|
test('a controller subscription moves the drape to the new host on every settled switch', async () => {
|
||||||
const listeners = new Set();
|
const listeners = new Set();
|
||||||
const controller = {
|
const controller = {
|
||||||
|
|||||||
@@ -1,26 +1,26 @@
|
|||||||
/**
|
/**
|
||||||
* Draped-imagery renderer for the Recent Imagery layer: at most two GIBS
|
* Draped-imagery renderer for the Recent Imagery layer: at most two GIBS
|
||||||
* imagery layers (slot `a`, left of a swipe; slot `b`, right) on whichever
|
* imagery layers (slot `a`, left of a swipe; slot `b`, right) through the
|
||||||
* host the map stack offers. Against the basemap slot `a` splits left and
|
* renderer's globe port, draped on whichever surface the map stack draws.
|
||||||
* slot `b` stays empty. Every layer is removed from the collection that owns it, so a
|
* Against the basemap slot `a` splits left and slot `b` stays empty. Tile
|
||||||
* host switch or a replaced image never strands one. Tile requests pass a
|
* requests pass a small semaphore of our own, shared by both slots, through
|
||||||
* small semaphore of our own; Cesium's global request limits stay untouched.
|
* each layer's admission hook; the renderer's own request limits stay
|
||||||
|
* untouched.
|
||||||
*/
|
*/
|
||||||
import * as Cesium from 'cesium';
|
// The layer flies through `cameraOf` and drapes through `findGlobe`; this
|
||||||
import { withTileRequestHook } from '../../render/cesium/tileRequests.js';
|
// renderer is its Cesium side, so it brings the factories a viewer with no
|
||||||
// The layer is Cesium-free and flies through `cameraOf`; its Cesium renderer
|
// renderer bound gets those ports from, and marks a tileset host as a base
|
||||||
// brings the factory a viewer with no renderer bound gets a camera from.
|
// the globe port drapes on.
|
||||||
import '../../render/cesium/camera.js';
|
import '../../render/cesium/camera.js';
|
||||||
|
import { markBaseTileset } from '../../render/cesium/globe.js';
|
||||||
import { PRODUCTS, gibsTemplate } from './model.js';
|
import { PRODUCTS, gibsTemplate } from './model.js';
|
||||||
|
|
||||||
const SLOT_IDS = ['a', 'b'];
|
const SLOT_IDS = ['a', 'b'];
|
||||||
const SPLIT_ENUM = { left: 'LEFT', right: 'RIGHT', none: 'NONE' };
|
const SPLITS = new Set(['left', 'right', 'none']);
|
||||||
const NO_HOST = Object.freeze({ collection: null, kind: 'none' });
|
const NO_HOST = Object.freeze({ collection: null, kind: 'none', globe: null });
|
||||||
|
|
||||||
/** Render reason for a deferred or settled tile request. */
|
/** Render reason for a settled tile request. */
|
||||||
export const TILE_RENDER_REASON = 'recent-imagery-tiles';
|
export const TILE_RENDER_REASON = 'recent-imagery-tiles';
|
||||||
/** Delay before the one frame that retries tiles Cesium itself deferred. */
|
|
||||||
export const TILE_RETRY_DELAY_MS = 250;
|
|
||||||
|
|
||||||
function clampAlpha(value) {
|
function clampAlpha(value) {
|
||||||
const alpha = Number(value);
|
const alpha = Number(value);
|
||||||
@@ -31,129 +31,90 @@ const boxKey = (box) =>
|
|||||||
[box.west, box.south, box.east, box.north].map(Number).join(',');
|
[box.west, box.south, box.east, box.north].map(Number).join(',');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gate a provider's tile requests through the semaphore. Returning
|
* Admit a tile request while the semaphore has room. A request that finds
|
||||||
* `undefined` tells Cesium to retry on a later frame, but under
|
* it full is deferred and asks for no frame itself: the request holding the
|
||||||
* `requestRenderMode` there is no later frame unless something asks — and a
|
* slot asks for one as it settles. One the renderer itself defers frees its
|
||||||
* deferral must never ask for one itself: the retried tile would defer again
|
* slot at once, and the renderer asks again on a later frame.
|
||||||
* and ask again, keeping the scene rendering every frame. So a request that
|
|
||||||
* finds our semaphore full asks for nothing (the request holding the slot
|
|
||||||
* asks for one frame when it settles), and a request the provider itself
|
|
||||||
* deferred goes through the one coalesced delayed retry.
|
|
||||||
*/
|
*/
|
||||||
function admitTileRequests(provider, admission, requestRender, retry) {
|
function admitTileRequests(admission, requestRender) {
|
||||||
return withTileRequestHook(provider, {
|
return (_tile, issue) => {
|
||||||
requestImage: (_tile, issue) => {
|
if (admission.inFlight >= admission.limit) return undefined;
|
||||||
if (admission.inFlight >= admission.limit) return undefined;
|
admission.inFlight += 1;
|
||||||
admission.inFlight += 1;
|
const release = () => {
|
||||||
const release = () => {
|
admission.inFlight -= 1;
|
||||||
admission.inFlight -= 1;
|
};
|
||||||
};
|
let promise;
|
||||||
let promise;
|
try {
|
||||||
try {
|
promise = issue();
|
||||||
promise = issue();
|
} catch (error) {
|
||||||
} catch (error) {
|
release();
|
||||||
release();
|
throw error;
|
||||||
throw error;
|
}
|
||||||
}
|
if (!promise) {
|
||||||
if (!promise) {
|
release();
|
||||||
release();
|
return undefined;
|
||||||
retry.schedule();
|
}
|
||||||
return undefined;
|
return Promise.resolve(promise).finally(() => {
|
||||||
}
|
release();
|
||||||
return Promise.resolve(promise).finally(() => {
|
requestRender(TILE_RENDER_REASON);
|
||||||
release();
|
});
|
||||||
requestRender(TILE_RENDER_REASON);
|
};
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the renderer.
|
* Create the renderer. The host it is bound to (`rebind`) carries the
|
||||||
* @param {{ cesium?: object, maxTileRequests?: number, requestRender?: (reason: string) => void, setTimeoutImpl?: Function, clearTimeoutImpl?: Function }} [options]
|
* viewer's globe port.
|
||||||
|
* @param {{ tileTemplate?: Function, credit?: string, maxTileRequests?: number, requestRender?: (reason: string) => void }} [options]
|
||||||
*/
|
*/
|
||||||
export function createRecentImageryRenderer({
|
export function createRecentImageryRenderer({
|
||||||
cesium = Cesium,
|
|
||||||
tileTemplate = gibsTemplate,
|
tileTemplate = gibsTemplate,
|
||||||
credit = 'NASA GIBS',
|
credit = 'NASA GIBS',
|
||||||
maxTileRequests = 6,
|
maxTileRequests = 6,
|
||||||
requestRender = () => {},
|
requestRender = () => {},
|
||||||
setTimeoutImpl = (fn, ms) => globalThis.setTimeout(fn, ms),
|
|
||||||
clearTimeoutImpl = (id) => globalThis.clearTimeout(id),
|
|
||||||
} = {}) {
|
} = {}) {
|
||||||
let host = NO_HOST;
|
let host = NO_HOST;
|
||||||
let destroyed = false;
|
let destroyed = false;
|
||||||
const admission = { limit: maxTileRequests, inFlight: 0 };
|
const admission = { limit: maxTileRequests, inFlight: 0 };
|
||||||
/** @type {Record<'a'|'b', null | { layer: object, collection: object, candidate: object, box: object, alpha: number, split: string }>} */
|
/** @type {Record<'a'|'b', null | { layer: object, globe: object, candidate: object, box: object, alpha: number, split: string }>} */
|
||||||
const owned = { a: null, b: null };
|
const owned = { a: null, b: null };
|
||||||
|
const admit = admitTileRequests(admission, requestRender);
|
||||||
|
|
||||||
// One timer for both slots: any number of upstream deferrals while it is
|
function specFor(candidate, box) {
|
||||||
// armed share the same single retry frame.
|
const product = PRODUCTS[candidate.product];
|
||||||
let retryTimer = null;
|
return {
|
||||||
const retry = {
|
kind: 'xyz',
|
||||||
schedule() {
|
|
||||||
if (retryTimer !== null) return;
|
|
||||||
retryTimer = setTimeoutImpl(() => {
|
|
||||||
retryTimer = null;
|
|
||||||
if (!destroyed) requestRender(TILE_RENDER_REASON);
|
|
||||||
}, TILE_RETRY_DELAY_MS);
|
|
||||||
},
|
|
||||||
cancel() {
|
|
||||||
if (retryTimer !== null) clearTimeoutImpl(retryTimer);
|
|
||||||
retryTimer = null;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
function createProvider(candidate, box) {
|
|
||||||
const spec = PRODUCTS[candidate.product];
|
|
||||||
const provider = new cesium.UrlTemplateImageryProvider({
|
|
||||||
url: tileTemplate(candidate.product, candidate.day),
|
url: tileTemplate(candidate.product, candidate.day),
|
||||||
subdomains: ['a', 'b', 'c'],
|
subdomains: ['a', 'b', 'c'],
|
||||||
minimumLevel: 0,
|
tiling: 'webMercator',
|
||||||
maximumLevel: spec.maxLevel,
|
minLevel: 0,
|
||||||
tilingScheme: new cesium.WebMercatorTilingScheme(),
|
maxLevel: product.maxLevel,
|
||||||
rectangle: cesium.Rectangle.fromDegrees(
|
rectangle: {
|
||||||
box.west,
|
west: box.west,
|
||||||
box.south,
|
south: box.south,
|
||||||
box.east,
|
east: box.east,
|
||||||
box.north,
|
north: box.north,
|
||||||
),
|
},
|
||||||
credit,
|
credit: { text: credit },
|
||||||
hasAlphaChannel: spec.format === 'png',
|
admit,
|
||||||
});
|
};
|
||||||
return admitTileRequests(provider, admission, requestRender, retry);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeOwned(slotId) {
|
function removeOwned(slotId) {
|
||||||
const record = owned[slotId];
|
const record = owned[slotId];
|
||||||
if (!record) return false;
|
if (!record) return false;
|
||||||
owned[slotId] = null;
|
owned[slotId] = null;
|
||||||
try {
|
record.layer.remove();
|
||||||
record.collection.remove(record.layer, true);
|
|
||||||
} catch {
|
|
||||||
/* the collection is already gone */
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyLook(record) {
|
function applyLook(record) {
|
||||||
record.layer.alpha = record.alpha;
|
record.layer.alpha = record.alpha;
|
||||||
record.layer.splitDirection =
|
record.layer.split = SPLITS.has(record.split) ? record.split : 'none';
|
||||||
cesium.SplitDirection?.[SPLIT_ENUM[record.split] || 'NONE'] ?? 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function mount(slotId, { candidate, box, alpha, split }) {
|
function mount(slotId, { candidate, box, alpha, split }) {
|
||||||
const layer = host.collection.addImageryProvider(
|
const layer = host.globe.imagery.add(specFor(candidate, box));
|
||||||
createProvider(candidate, box),
|
owned[slotId] = { layer, globe: host.globe, candidate, box, alpha, split };
|
||||||
);
|
|
||||||
owned[slotId] = {
|
|
||||||
layer,
|
|
||||||
collection: host.collection,
|
|
||||||
candidate,
|
|
||||||
box,
|
|
||||||
alpha,
|
|
||||||
split,
|
|
||||||
};
|
|
||||||
applyLook(owned[slotId]);
|
applyLook(owned[slotId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,7 +135,7 @@ export function createRecentImageryRenderer({
|
|||||||
{ alpha = 1, splitDirection = 'none' } = {},
|
{ alpha = 1, splitDirection = 'none' } = {},
|
||||||
) {
|
) {
|
||||||
if (destroyed || !candidate?.key || !box) return false;
|
if (destroyed || !candidate?.key || !box) return false;
|
||||||
if (!host.collection) {
|
if (!host.globe) {
|
||||||
removeOwned(slotId);
|
removeOwned(slotId);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -182,7 +143,7 @@ export function createRecentImageryRenderer({
|
|||||||
const look = { alpha: clampAlpha(alpha), split: splitDirection };
|
const look = { alpha: clampAlpha(alpha), split: splitDirection };
|
||||||
if (
|
if (
|
||||||
current &&
|
current &&
|
||||||
current.collection === host.collection &&
|
current.globe === host.globe &&
|
||||||
current.candidate.key === candidate.key &&
|
current.candidate.key === candidate.key &&
|
||||||
boxKey(current.box) === boxKey(box)
|
boxKey(current.box) === boxKey(box)
|
||||||
) {
|
) {
|
||||||
@@ -218,19 +179,25 @@ export function createRecentImageryRenderer({
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move every owned layer to a new host. Layers are rebuilt there, never
|
* Follow the map stack's host. The globe port moves the owned layers
|
||||||
* re-parented, so the old collection is left as it was found.
|
* between the globe and the 3D tiles itself; without a host they go,
|
||||||
* @param {{ collection: object | null, kind: string }} nextHost
|
* and a new globe port gets them rebuilt.
|
||||||
|
* @param {{ collection: object | null, kind: string, globe?: object | null, tileset?: object | null }} nextHost
|
||||||
*/
|
*/
|
||||||
rebind(nextHost) {
|
rebind(nextHost) {
|
||||||
host = nextHost || NO_HOST;
|
const previous = host;
|
||||||
let changed = false;
|
host =
|
||||||
|
nextHost && nextHost.kind !== 'none' && nextHost.globe
|
||||||
|
? nextHost
|
||||||
|
: NO_HOST;
|
||||||
|
if (host.kind === 'tileset') markBaseTileset(host.tileset);
|
||||||
|
let changed = host.kind !== previous.kind && Boolean(owned.a || owned.b);
|
||||||
for (const slotId of SLOT_IDS) {
|
for (const slotId of SLOT_IDS) {
|
||||||
const record = owned[slotId];
|
const record = owned[slotId];
|
||||||
if (!record || record.collection === host.collection) continue;
|
if (!record || record.globe === host.globe) continue;
|
||||||
removeOwned(slotId);
|
removeOwned(slotId);
|
||||||
changed = true;
|
changed = true;
|
||||||
if (host.collection && !destroyed) mount(slotId, record);
|
if (host.globe && !destroyed) mount(slotId, record);
|
||||||
}
|
}
|
||||||
if (changed) requestRender('recent-imagery-rebind');
|
if (changed) requestRender('recent-imagery-rebind');
|
||||||
},
|
},
|
||||||
@@ -261,7 +228,6 @@ export function createRecentImageryRenderer({
|
|||||||
destroy() {
|
destroy() {
|
||||||
if (destroyed) return;
|
if (destroyed) return;
|
||||||
destroyed = true;
|
destroyed = true;
|
||||||
retry.cancel();
|
|
||||||
let changed = false;
|
let changed = false;
|
||||||
for (const slotId of SLOT_IDS) changed = removeOwned(slotId) || changed;
|
for (const slotId of SLOT_IDS) changed = removeOwned(slotId) || changed;
|
||||||
host = NO_HOST;
|
host = NO_HOST;
|
||||||
|
|||||||
@@ -2,86 +2,51 @@ import test from 'node:test';
|
|||||||
import assert from 'node:assert/strict';
|
import assert from 'node:assert/strict';
|
||||||
import {
|
import {
|
||||||
TILE_RENDER_REASON,
|
TILE_RENDER_REASON,
|
||||||
TILE_RETRY_DELAY_MS,
|
|
||||||
createRecentImageryRenderer,
|
createRecentImageryRenderer,
|
||||||
} from './rendering.js';
|
} from './rendering.js';
|
||||||
import { BOX, manualTimers } from './testDoubles.mjs';
|
import { BOX } from './testDoubles.mjs';
|
||||||
|
import { fakeGlobePort } from '../../testSupport/fakeGlobePort.mjs';
|
||||||
/** A provider whose tile requests stay pending until the test settles them. */
|
|
||||||
class UrlTemplateImageryProvider {
|
|
||||||
constructor(options) {
|
|
||||||
this.options = options;
|
|
||||||
this.calls = [];
|
|
||||||
this.pending = [];
|
|
||||||
}
|
|
||||||
requestImage(x, y, level) {
|
|
||||||
this.calls.push([x, y, level]);
|
|
||||||
return new Promise((resolve) => this.pending.push(resolve));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function fakeCesium(requestImage) {
|
|
||||||
class Provider extends UrlTemplateImageryProvider {}
|
|
||||||
if (requestImage) Provider.prototype.requestImage = requestImage;
|
|
||||||
return {
|
|
||||||
UrlTemplateImageryProvider: Provider,
|
|
||||||
WebMercatorTilingScheme: class {},
|
|
||||||
Rectangle: {
|
|
||||||
fromDegrees: (west, south, east, north) => ({ west, south, east, north }),
|
|
||||||
},
|
|
||||||
SplitDirection: { LEFT: -1, NONE: 0, RIGHT: 1 },
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function fakeCollection() {
|
|
||||||
const layers = [];
|
|
||||||
return {
|
|
||||||
layers,
|
|
||||||
addImageryProvider(provider) {
|
|
||||||
const layer = { provider, alpha: 1, splitDirection: 0 };
|
|
||||||
layers.push(layer);
|
|
||||||
return layer;
|
|
||||||
},
|
|
||||||
remove(layer, destroy) {
|
|
||||||
layers.splice(layers.indexOf(layer), 1);
|
|
||||||
layer.destroyed = destroy;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const S30 = { key: 'S30:2026-09-18', product: 'S30', day: '2026-09-18' };
|
const S30 = { key: 'S30:2026-09-18', product: 'S30', day: '2026-09-18' };
|
||||||
const L30 = { key: 'L30:2026-09-16', product: 'L30', day: '2026-09-16' };
|
const L30 = { key: 'L30:2026-09-16', product: 'L30', day: '2026-09-16' };
|
||||||
const VIIRS = { key: 'VIIRS:2026-09-20', product: 'VIIRS', day: '2026-09-20' };
|
const VIIRS = { key: 'VIIRS:2026-09-20', product: 'VIIRS', day: '2026-09-20' };
|
||||||
|
|
||||||
function fixture({ requestImage, maxTileRequests, ...options } = {}) {
|
/** A tile fetch that stays pending until the test settles it. */
|
||||||
const renders = [];
|
function pendingFetches() {
|
||||||
const timers = manualTimers();
|
const pending = [];
|
||||||
const renderer = createRecentImageryRenderer({
|
const fetch = () => new Promise((resolve) => pending.push(resolve));
|
||||||
...options,
|
return { pending, fetch };
|
||||||
cesium: fakeCesium(requestImage),
|
|
||||||
maxTileRequests,
|
|
||||||
requestRender: (reason) => renders.push(reason),
|
|
||||||
setTimeoutImpl: timers.setTimeoutImpl,
|
|
||||||
clearTimeoutImpl: timers.clearTimeoutImpl,
|
|
||||||
});
|
|
||||||
const globe = fakeCollection();
|
|
||||||
renderer.rebind({ collection: globe, kind: 'globe' });
|
|
||||||
const tileFrames = () =>
|
|
||||||
renders.filter((reason) => reason === TILE_RENDER_REASON).length;
|
|
||||||
return { renderer, globe, renders, timers, tileFrames };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
test('a slot drapes one GIBS provider bounded to the box; the same day only restyles it', () => {
|
function fixture({ maxTileRequests, ...options } = {}) {
|
||||||
|
const renders = [];
|
||||||
|
const renderer = createRecentImageryRenderer({
|
||||||
|
...options,
|
||||||
|
maxTileRequests,
|
||||||
|
requestRender: (reason) => renders.push(reason),
|
||||||
|
});
|
||||||
|
const globe = fakeGlobePort();
|
||||||
|
renderer.rebind({ collection: {}, kind: 'globe', globe });
|
||||||
|
const tileFrames = () =>
|
||||||
|
renders.filter((reason) => reason === TILE_RENDER_REASON).length;
|
||||||
|
return { renderer, globe, renders, tileFrames };
|
||||||
|
}
|
||||||
|
|
||||||
|
const tile = (x, level = 1) => ({ x, y: 0, level });
|
||||||
|
|
||||||
|
test('a slot drapes one GIBS layer bounded to the box; the same day only restyles it', () => {
|
||||||
const { renderer, globe, renders } = fixture();
|
const { renderer, globe, renders } = fixture();
|
||||||
assert.equal(renderer.showSlot('a', S30, BOX, { alpha: 0.8 }), true);
|
assert.equal(renderer.showSlot('a', S30, BOX, { alpha: 0.8 }), true);
|
||||||
const [layer] = globe.layers;
|
const [layer] = globe.layers;
|
||||||
assert.match(
|
assert.match(
|
||||||
layer.provider.options.url,
|
layer.spec.url,
|
||||||
/^https:\/\/gibs-\{s\}\.earthdata\.nasa\.gov\/.*HLS_S30.*\/2026-09-18\/GoogleMapsCompatible_Level12\/\{z\}\/\{y\}\/\{x\}\.png$/,
|
/^https:\/\/gibs-\{s\}\.earthdata\.nasa\.gov\/.*HLS_S30.*\/2026-09-18\/GoogleMapsCompatible_Level12\/\{z\}\/\{y\}\/\{x\}\.png$/,
|
||||||
);
|
);
|
||||||
assert.deepEqual(layer.provider.options.subdomains, ['a', 'b', 'c']);
|
assert.equal(layer.spec.kind, 'xyz');
|
||||||
assert.equal(layer.provider.options.credit, 'NASA GIBS');
|
assert.equal(layer.spec.tiling, 'webMercator');
|
||||||
assert.deepEqual(layer.provider.options.rectangle, BOX);
|
assert.deepEqual(layer.spec.subdomains, ['a', 'b', 'c']);
|
||||||
|
assert.deepEqual(layer.spec.credit, { text: 'NASA GIBS' });
|
||||||
|
assert.deepEqual(layer.spec.rectangle, BOX);
|
||||||
assert.equal(layer.alpha, 0.8);
|
assert.equal(layer.alpha, 0.8);
|
||||||
assert.deepEqual(renders, ['recent-imagery-show']);
|
assert.deepEqual(renders, ['recent-imagery-show']);
|
||||||
assert.deepEqual(renderer.getOwned().a, {
|
assert.deepEqual(renderer.getOwned().a, {
|
||||||
@@ -92,16 +57,15 @@ test('a slot drapes one GIBS provider bounded to the box; the same day only rest
|
|||||||
});
|
});
|
||||||
renderer.showSlot('a', S30, BOX, { alpha: 0.5, splitDirection: 'left' });
|
renderer.showSlot('a', S30, BOX, { alpha: 0.5, splitDirection: 'left' });
|
||||||
assert.deepEqual(globe.layers, [layer], 'the layer is reused');
|
assert.deepEqual(globe.layers, [layer], 'the layer is reused');
|
||||||
assert.equal(layer.splitDirection, -1);
|
assert.equal(layer.split, 'left');
|
||||||
// A different day replaces the layer in its own collection.
|
// A different day replaces the layer.
|
||||||
renderer.showSlot('a', L30, BOX);
|
renderer.showSlot('a', L30, BOX);
|
||||||
assert.equal(layer.destroyed, true);
|
assert.equal(layer.removed, true);
|
||||||
assert.equal(globe.layers.length, 1);
|
assert.equal(globe.layers.length, 1);
|
||||||
// VIIRS is a level-9 JPEG overview with no alpha channel.
|
// VIIRS is a level-9 overview.
|
||||||
renderer.showSlot('b', VIIRS, BOX, { splitDirection: 'right' });
|
renderer.showSlot('b', VIIRS, BOX, { splitDirection: 'right' });
|
||||||
assert.equal(globe.layers[1].provider.options.maximumLevel, 9);
|
assert.equal(globe.layers[1].spec.maxLevel, 9);
|
||||||
assert.equal(globe.layers[1].provider.options.hasAlphaChannel, false);
|
assert.equal(globe.layers[1].split, 'right');
|
||||||
assert.equal(globe.layers[1].splitDirection, 1);
|
|
||||||
renderer.setAlpha('b', 7);
|
renderer.setAlpha('b', 7);
|
||||||
assert.equal(globe.layers[1].alpha, 1, 'alpha clamps to 0–1');
|
assert.equal(globe.layers[1].alpha, 1, 'alpha clamps to 0–1');
|
||||||
});
|
});
|
||||||
@@ -120,80 +84,92 @@ test('rapid replacement never owns more than two layers', () => {
|
|||||||
assert.equal(globe.layers.length, 0);
|
assert.equal(globe.layers.length, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('rebind rebuilds the owned layers on the new host and leaves the old one empty', () => {
|
test('the renderer leaves the surface to the globe port; no host removes the layers; a new port rebuilds them', () => {
|
||||||
const { renderer, globe } = fixture();
|
const { renderer, globe, renders } = fixture();
|
||||||
renderer.showSlot('a', S30, BOX, { alpha: 0.6, splitDirection: 'left' });
|
renderer.showSlot('a', S30, BOX, { alpha: 0.6, splitDirection: 'left' });
|
||||||
renderer.showSlot('b', L30, BOX, { splitDirection: 'right' });
|
renderer.showSlot('b', L30, BOX, { splitDirection: 'right' });
|
||||||
const tileset = fakeCollection();
|
const layers = [...globe.layers];
|
||||||
renderer.rebind({ collection: tileset, kind: 'tileset' });
|
renders.length = 0;
|
||||||
assert.equal(globe.layers.length, 0);
|
renderer.rebind({ collection: {}, kind: 'tileset', globe, tileset: {} });
|
||||||
assert.deepEqual(
|
assert.deepEqual(globe.layers, layers, 'the port drapes them on the tiles');
|
||||||
tileset.layers.map((layer) => [layer.alpha, layer.splitDirection]),
|
assert.ok(
|
||||||
[
|
layers.every((layer) => layer.drapeOn === 'all'),
|
||||||
[0.6, -1],
|
'the renderer never narrows where they drape',
|
||||||
[1, 1],
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
assert.equal(renderer.getOwned().a.kind, 'tileset');
|
assert.equal(renderer.getOwned().a.kind, 'tileset');
|
||||||
renderer.rebind({ collection: null, kind: 'none' });
|
assert.deepEqual(renders, ['recent-imagery-rebind'], 'the move gets a frame');
|
||||||
assert.equal(tileset.layers.length, 0);
|
renderer.rebind({ collection: {}, kind: 'globe', globe: null });
|
||||||
|
assert.equal(
|
||||||
|
globe.layers.length,
|
||||||
|
0,
|
||||||
|
'a host with no globe port drapes nothing',
|
||||||
|
);
|
||||||
assert.equal(renderer.showSlot('a', S30, BOX), false);
|
assert.equal(renderer.showSlot('a', S30, BOX), false);
|
||||||
renderer.rebind({ collection: globe, kind: 'globe' });
|
renderer.rebind({ collection: {}, kind: 'globe', globe });
|
||||||
renderer.showSlot('a', S30, BOX);
|
renderer.rebind({ collection: null, kind: 'none', globe });
|
||||||
renderer.destroy();
|
|
||||||
assert.equal(globe.layers.length, 0);
|
assert.equal(globe.layers.length, 0);
|
||||||
|
assert.equal(renderer.showSlot('a', S30, BOX), false);
|
||||||
|
const other = fakeGlobePort();
|
||||||
|
renderer.rebind({ collection: {}, kind: 'globe', globe });
|
||||||
|
renderer.showSlot('a', S30, BOX, { alpha: 0.6, splitDirection: 'left' });
|
||||||
|
renderer.showSlot('b', L30, BOX, { splitDirection: 'right' });
|
||||||
|
renderer.rebind({ collection: {}, kind: 'globe', globe: other });
|
||||||
|
assert.equal(globe.layers.length, 0);
|
||||||
|
assert.deepEqual(
|
||||||
|
other.layers.map((layer) => [layer.alpha, layer.split]),
|
||||||
|
[
|
||||||
|
[0.6, 'left'],
|
||||||
|
[1, 'right'],
|
||||||
|
],
|
||||||
|
);
|
||||||
|
renderer.destroy();
|
||||||
|
assert.equal(other.layers.length, 0);
|
||||||
assert.equal(renderer.showSlot('a', S30, BOX), false, 'destroyed');
|
assert.equal(renderer.showSlot('a', S30, BOX), false, 'destroyed');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('above the tile limit a request defers silently; its settlement asks for exactly one frame', async () => {
|
test('above the tile limit a request defers silently; its settlement asks for exactly one frame', async () => {
|
||||||
const { renderer, globe, timers, tileFrames } = fixture({
|
const { renderer, globe, tileFrames } = fixture({ maxTileRequests: 1 });
|
||||||
maxTileRequests: 1,
|
|
||||||
});
|
|
||||||
renderer.showSlot('a', S30, BOX);
|
renderer.showSlot('a', S30, BOX);
|
||||||
const { provider } = globe.layers[0];
|
const [layer] = globe.layers;
|
||||||
const first = provider.requestImage(0, 0, 1);
|
const { pending, fetch } = pendingFetches();
|
||||||
|
const first = layer.request(tile(0), fetch);
|
||||||
assert.ok(first instanceof Promise);
|
assert.ok(first instanceof Promise);
|
||||||
for (let i = 1; i <= 120; i += 1)
|
for (let i = 1; i <= 120; i += 1)
|
||||||
assert.equal(provider.requestImage(i, 0, 1), undefined);
|
assert.equal(layer.request(tile(i), fetch), undefined);
|
||||||
assert.equal(provider.calls.length, 1, 'deferred requests never go out');
|
assert.equal(pending.length, 1, 'deferred requests never go out');
|
||||||
assert.equal(tileFrames(), 0, 'a deferral asks for no frame');
|
assert.equal(tileFrames(), 0, 'a deferral asks for no frame');
|
||||||
assert.equal(timers.armed(), 0);
|
pending[0]('tile');
|
||||||
provider.pending[0]('tile');
|
|
||||||
await first;
|
await first;
|
||||||
assert.equal(tileFrames(), 1, 'the settlement asks for the retry frame');
|
assert.equal(tileFrames(), 1, 'the settlement asks for the retry frame');
|
||||||
assert.ok(provider.requestImage(200, 0, 1) instanceof Promise);
|
assert.ok(layer.request(tile(200), fetch) instanceof Promise);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('upstream deferrals from both slots share one delayed retry frame; destroy disarms it', () => {
|
test('both slots share the budget; a renderer deferral or throw frees its slot', async () => {
|
||||||
let throwNext = false;
|
const { renderer, globe, tileFrames } = fixture({ maxTileRequests: 1 });
|
||||||
const { renderer, globe, timers, tileFrames } = fixture({
|
|
||||||
maxTileRequests: 1,
|
|
||||||
requestImage() {
|
|
||||||
if (throwNext) throw new Error('boom');
|
|
||||||
return undefined;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
renderer.showSlot('a', S30, BOX);
|
renderer.showSlot('a', S30, BOX);
|
||||||
renderer.showSlot('b', L30, BOX);
|
renderer.showSlot('b', L30, BOX);
|
||||||
for (const { provider } of globe.layers)
|
const [a, b] = globe.layers;
|
||||||
for (let i = 0; i < 40; i += 1)
|
const { pending, fetch } = pendingFetches();
|
||||||
assert.equal(provider.requestImage(i, 0, 0), undefined);
|
const held = a.request(tile(0), fetch);
|
||||||
// Every deferral released its slot (the limit is one), and none asked
|
assert.equal(b.request(tile(0), fetch), undefined, 'the other slot waits');
|
||||||
// for a frame of its own: one timer holds the single retry.
|
pending[0]('tile');
|
||||||
assert.equal(tileFrames(), 0);
|
await held;
|
||||||
assert.equal(timers.armed(), 1);
|
// The renderer itself defers: the slot is free at once.
|
||||||
assert.equal([...timers.pending.values()][0].ms, TILE_RETRY_DELAY_MS);
|
for (let i = 0; i < 40; i += 1)
|
||||||
timers.flush();
|
assert.equal(
|
||||||
|
b.request(tile(i), () => undefined),
|
||||||
|
undefined,
|
||||||
|
);
|
||||||
|
assert.throws(
|
||||||
|
() =>
|
||||||
|
a.request(tile(0), () => {
|
||||||
|
throw new Error('boom');
|
||||||
|
}),
|
||||||
|
/boom/,
|
||||||
|
);
|
||||||
|
assert.ok(b.request(tile(1), fetch) instanceof Promise, 'still room');
|
||||||
assert.equal(tileFrames(), 1);
|
assert.equal(tileFrames(), 1);
|
||||||
// A throwing provider releases its slot too.
|
|
||||||
throwNext = true;
|
|
||||||
assert.throws(() => globe.layers[0].provider.requestImage(0, 0, 0), /boom/);
|
|
||||||
throwNext = false;
|
|
||||||
globe.layers[0].provider.requestImage(0, 0, 0);
|
|
||||||
assert.equal(timers.armed(), 1, 'the next deferral arms a fresh timer');
|
|
||||||
renderer.destroy();
|
renderer.destroy();
|
||||||
assert.equal(timers.armed(), 0, 'destroy disarms the retry');
|
|
||||||
assert.equal(tileFrames(), 1);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('against the basemap slot a splits left with no second layer, and leaving the swipe only restyles it', () => {
|
test('against the basemap slot a splits left with no second layer, and leaving the swipe only restyles it', () => {
|
||||||
@@ -201,12 +177,12 @@ test('against the basemap slot a splits left with no second layer, and leaving t
|
|||||||
renderer.showSlot('a', S30, BOX, { splitDirection: 'left' });
|
renderer.showSlot('a', S30, BOX, { splitDirection: 'left' });
|
||||||
renderer.hideSlot('b');
|
renderer.hideSlot('b');
|
||||||
assert.equal(globe.layers.length, 1, 'the basemap is the right side');
|
assert.equal(globe.layers.length, 1, 'the basemap is the right side');
|
||||||
assert.equal(globe.layers[0].splitDirection, -1);
|
assert.equal(globe.layers[0].split, 'left');
|
||||||
assert.equal(renderer.getOwned().b, null);
|
assert.equal(renderer.getOwned().b, null);
|
||||||
const [layer] = globe.layers;
|
const [layer] = globe.layers;
|
||||||
renderer.showSlot('a', S30, BOX, { splitDirection: 'none' });
|
renderer.showSlot('a', S30, BOX, { splitDirection: 'none' });
|
||||||
assert.deepEqual(globe.layers, [layer], 'no rebuild for a new look');
|
assert.deepEqual(globe.layers, [layer], 'no rebuild for a new look');
|
||||||
assert.equal(layer.splitDirection, 0);
|
assert.equal(layer.split, 'none');
|
||||||
assert.deepEqual(renders, ['recent-imagery-show', 'recent-imagery-look']);
|
assert.deepEqual(renders, ['recent-imagery-show', 'recent-imagery-look']);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -219,11 +195,11 @@ test('replacement imagery uses source-owned tile URLs and credit and tears down
|
|||||||
assert.equal(renderer.showSlot('a', S30, BOX), true);
|
assert.equal(renderer.showSlot('a', S30, BOX), true);
|
||||||
const layer = globe.layers[0];
|
const layer = globe.layers[0];
|
||||||
assert.equal(
|
assert.equal(
|
||||||
layer.provider.options.url,
|
layer.spec.url,
|
||||||
'https://tiles.example/S30/2026-09-18/{z}/{x}/{y}',
|
'https://tiles.example/S30/2026-09-18/{z}/{x}/{y}',
|
||||||
);
|
);
|
||||||
assert.equal(layer.provider.options.credit, 'Example imagery');
|
assert.deepEqual(layer.spec.credit, { text: 'Example imagery' });
|
||||||
renderer.destroy();
|
renderer.destroy();
|
||||||
assert.equal(globe.layers.length, 0);
|
assert.equal(globe.layers.length, 0);
|
||||||
assert.equal(layer.destroyed, true);
|
assert.equal(layer.removed, true);
|
||||||
});
|
});
|
||||||
@@ -214,10 +214,14 @@ export function fakeRenderer() {
|
|||||||
const owned = { a: null, b: null };
|
const owned = { a: null, b: null };
|
||||||
let host = { kind: 'none' };
|
let host = { kind: 'none' };
|
||||||
let peak = 0;
|
let peak = 0;
|
||||||
|
/** Every host the renderer was bound to, as given. */
|
||||||
|
const hosts = [];
|
||||||
return {
|
return {
|
||||||
calls,
|
calls,
|
||||||
|
hosts,
|
||||||
rebind(next) {
|
rebind(next) {
|
||||||
calls.push(['rebind', next.kind]);
|
calls.push(['rebind', next.kind]);
|
||||||
|
hosts.push(next);
|
||||||
host = next;
|
host = next;
|
||||||
for (const slot of ['a', 'b'])
|
for (const slot of ['a', 'b'])
|
||||||
if (owned[slot]) owned[slot] = { ...owned[slot], kind: next.kind };
|
if (owned[slot]) owned[slot] = { ...owned[slot], kind: next.kind };
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ import {
|
|||||||
import { formatUtcDayMonth, t, msg } from '../../i18n/index.js';
|
import { formatUtcDayMonth, t, msg } from '../../i18n/index.js';
|
||||||
import { formatScaleLabel } from '../../ui/unitLabels.js';
|
import { formatScaleLabel } from '../../ui/unitLabels.js';
|
||||||
import { cameraOf } from '../../render/cesium/camera.js';
|
import { cameraOf } from '../../render/cesium/camera.js';
|
||||||
|
// The renderer drapes through `findGlobe`; a viewer with no renderer bound
|
||||||
|
// gets its globe port from the factory this module provides.
|
||||||
|
import '../../render/cesium/globe.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A stored (English) failure in the language. HTTP failures from source.js
|
* A stored (English) failure in the language. HTTP failures from source.js
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
import * as Cesium from 'cesium';
|
import * as Cesium from 'cesium';
|
||||||
import { createWindRendering } from './rendering.js';
|
import { createWindRendering } from './rendering.js';
|
||||||
|
// The renderer drapes through `findGlobe`; a viewer with no renderer bound
|
||||||
|
// gets its globe port from the factory this module provides.
|
||||||
|
import '../../render/cesium/globe.js';
|
||||||
import { WIND_FIELDS } from './fields.js';
|
import { WIND_FIELDS } from './fields.js';
|
||||||
import {
|
import {
|
||||||
formatWindReading,
|
formatWindReading,
|
||||||
|
|||||||
@@ -196,7 +196,9 @@ function checkLookupFactory(lookup, factory, { reached = true } = {}) {
|
|||||||
const calls = (file) =>
|
const calls = (file) =>
|
||||||
!file.startsWith('src/render/') &&
|
!file.startsWith('src/render/') &&
|
||||||
/\.(m?js|vue)$/.test(file) &&
|
/\.(m?js|vue)$/.test(file) &&
|
||||||
readFileSync(path.join(root, file), 'utf8').includes(`${lookup}(`);
|
new RegExp(`\\b${lookup}\\b`).test(
|
||||||
|
readFileSync(path.join(root, file), 'utf8'),
|
||||||
|
);
|
||||||
for (const [key, declaration] of Object.entries(pkg.exports)) {
|
for (const [key, declaration] of Object.entries(pkg.exports)) {
|
||||||
const target = browserTarget(declaration);
|
const target = browserTarget(declaration);
|
||||||
if (typeof target !== 'string' || !target.startsWith('./src/')) continue;
|
if (typeof target !== 'string' || !target.startsWith('./src/')) continue;
|
||||||
@@ -221,8 +223,9 @@ test('every public entry that reaches a findEffects caller loads the unbound eff
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('every public entry that reaches a findGlobe caller loads the unbound globe factory', () => {
|
test('every public entry that reaches a findGlobe caller loads the unbound globe factory', () => {
|
||||||
// Only the application reaches one today, through no public entry.
|
// A caller may take `findGlobe` as a default rather than call it, so any
|
||||||
checkLookupFactory('findGlobe', GLOBE_FACTORY, { reached: false });
|
// use of the name counts.
|
||||||
|
checkLookupFactory('findGlobe', GLOBE_FACTORY);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('the unbound export brings every unbound factory', () => {
|
test('the unbound export brings every unbound factory', () => {
|
||||||
|
|||||||
Reference in new issue
Block a user