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

+7 -18
View File
@@ -1,3 +1,4 @@
import { createFakeEngine } from '../globe/testing/fakeEngine.js';
import { createSessionHandoff } from '../app/sessionHandoff.js';
import assert from 'node:assert/strict';
import test from 'node:test';
@@ -479,10 +480,7 @@ test('pagehide while the outgoing engine is released starts nothing', async () =
test('a slow first frame never rolls back a started engine', async () => {
const timers = [];
const engine = {
frames: { postRender: { addEventListener: () => () => {} } },
render: { request() {} },
};
const engine = createFakeEngine();
const h = harness();
let frame;
const machine = createEngineSwitch({
@@ -525,21 +523,12 @@ test('the first-frame wait resolves on a frame, on a hidden tab and on timeout',
};
let draw;
let requests = 0;
const engine = {
frames: {
postRender: {
addEventListener(fn) {
draw = fn;
return () => {
draw = null;
};
},
},
},
render: {
request: () => requests++,
},
const engine = createFakeEngine();
engine.frames.postRender.addEventListener = (fn) => {
draw = fn;
return () => { draw = null; };
};
engine.render.request = () => requests++;
const timers = new Map();
const options = {
document: doc,