From 7f0572cf4c0be014c2d235ecbec918dfb867619a Mon Sep 17 00:00:00 2001 From: German Khokhlov Date: Tue, 3 Nov 2026 15:36:11 +0400 Subject: [PATCH] Run upstream's HUD summary and standalone startup tests against the engine-based HUD and application --- src/hudSummaryLine.test.mjs | 4 +++- src/mapStartup.test.mjs | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/hudSummaryLine.test.mjs b/src/hudSummaryLine.test.mjs index 2e8845e88..e10a999de 100644 --- a/src/hudSummaryLine.test.mjs +++ b/src/hudSummaryLine.test.mjs @@ -2,6 +2,7 @@ import { test } from 'node:test'; import assert from 'node:assert/strict'; import './testSupport/stubMgrs.mjs'; import { hudReadouts } from './testSupport/hudReadouts.mjs'; +import { viewerEngine } from './testSupport/viewerEngine.mjs'; const { IntelHUD } = await import('./hud.js'); const { setLocale } = await import('./i18n/index.js'); @@ -49,7 +50,8 @@ function createHud( }, }; const sent = []; - const hud = new IntelHUD(viewer, { + const hud = new IntelHUD(viewerEngine(viewer), { + viewer, publish, summaryService: { configured: async () => true, diff --git a/src/mapStartup.test.mjs b/src/mapStartup.test.mjs index 9d438643d..63b928dfc 100644 --- a/src/mapStartup.test.mjs +++ b/src/mapStartup.test.mjs @@ -59,7 +59,9 @@ async function standaloneStartup(Cesium, credentials, fetchImpl) { ) // Imports may span lines (`import {\n a,\n b,\n} from '…';`). .replace(/^import [^;]*;\n/gm, '') - .replace(/^export /gm, ''); + .replace(/^export /gm, '') + // A classic script has no import.meta; the dev-only branches stay off. + .replace(/import\.meta\.env/g, '({}).env'); const context = vm.createContext({ document: { getElementById: () => ({ querySelector: () => ({}) }), @@ -72,7 +74,8 @@ async function standaloneStartup(Cesium, credentials, fetchImpl) { applyDocumentLanguage() {}, applyDocumentTranslations() {}, CITY_POIS: [], - createApplication: (options) => options, + createApplication: (options) => ({ ...options, subscribe() {} }), + resolveEngineKind: () => 'cesium', createStandalonePlaceSearch: () => ({}), createStandaloneCatalog: () => ({}), createGoogleTokenSource: () => createGoogleTokenSource({ fetchImpl }),