Stub setBase: imagery is added before photoreal is awaited

An unawaited setBase with photoreal and imagery, followed by another,
added its imagery after the later call had set its own, leaving both.
The imagery now goes in before anything is awaited, as the Cesium port
adds it, and an overtaken call resolves settled: false.
This commit is contained in:
Sameh Khamis committed 2026-11-11 20:01:20 -08:00
1 parent ca82e23d94
commit db80c9f141
2 files changed
+23 -2

No files matched your search

+14
View File
@@ -238,3 +238,17 @@ test('a slow vector setBase a later setBase supersedes changes nothing, nor one
globalThis.fetch = original;
}
});
test('two setBase calls, neither awaited, leave the later one’s imagery alone', async () => {
const r = createStubRenderer();
const url = (name) => `https://${name}.invalid/{z}/{x}/{y}.png`;
const first = r.globe.setBase({
photoreal: null,
imagery: [{ kind: 'xyz', url: url('a') }],
});
const second = r.globe.setBase({ imagery: [{ kind: 'xyz', url: url('b') }] });
const [, later] = await Promise.all([first, second]);
assert.deepEqual(r.globe.imagery.list(), later.imagery);
assert.equal((await first).settled, false, 'the overtaken one');
r.destroy();
});