Build test engines from the shared fake instead of literals

Tests that made their own engine object now use createFakeEngine() with
its scripting hooks or an override of the one member under test, so they
follow the contract when it changes. 125 such literals in 74 test files
go down to two that are not globe engines on purpose; report-qa-harness
counts them, and the baseline keeps the number from growing.
This commit is contained in:
German Khokhlov committed 2026-11-10 17:07:27 +04:00
1 parent 3c304502a0
commit 225c1c25c7
76 files changed
+668 -564

No files matched your search

+12 -15
View File
@@ -1,3 +1,4 @@
import { createFakeEngine } from '../globe/testing/fakeEngine.js';
// Behavioral tests for DISPLAY ▸ Import: the controller is driven against
// fake DOM and engine doubles with an injected loader and drawing, and its
// observable effects are asserted — drawings made and destroyed, the rows
@@ -65,22 +66,18 @@ class FakeElement {
/** A globe engine double: its host, camera moves and render requests. */
function fakeEngine() {
const moveEnd = new Set();
const engine = {
const engine = createFakeEngine({
kind: 'fake',
host: {
container: new FakeElement('div', 'cesiumContainer'),
canvas: new FakeElement('canvas'),
},
camera: {
moveEnd: {
addEventListener: (fn) => (moveEnd.add(fn), () => moveEnd.delete(fn)),
},
},
surface: { tilesLoaded: () => true },
renders: 0,
render: { request: () => (engine.renders += 1) },
moveEnd,
};
container: new FakeElement('div', 'cesiumContainer'),
canvas: new FakeElement('canvas'),
});
engine.camera.moveEnd.addEventListener = (fn) => (
moveEnd.add(fn),
() => moveEnd.delete(fn)
);
engine.renders = 0;
engine.render.request = () => (engine.renders += 1);
engine.moveEnd = moveEnd;
return engine;
}