Files
NODEDC_MISSION_CORE/apps/control-station/test/planningSceneTools.test.mjs
T
DCCONSTRUCTIONS e515ab1b8c feat(planning): consolidate recorded-route localization and spatial scene
Preserve the completed teach-and-repeat laboratory stage: reference preparation, cascaded acquisition, local tracking and recovery, recording lifecycle, replay qualification, and persistent Rerun scene controls. Document the open grid-picking regression and Rerun upgrade contract. No autonomous driving or loop-closure optimization is claimed.
2026-09-21 08:47:19 +03:00

36 lines
2.1 KiB
JavaScript

import assert from 'node:assert/strict';
import {before,after,test} from 'node:test';
import {createServer} from 'vite';
import {createElement} from 'react';
import {renderToStaticMarkup} from 'react-dom/server';
import {readFileSync} from 'node:fs';
let server,Tool,Actions;
before(async()=>{
server=await createServer({appType:'custom',logLevel:'silent',server:{middlewareMode:true}});
({PlanningSceneToolWindow:Tool}=await server.ssrLoadModule('/src/components/missions/PlanningSceneToolWindow.tsx'));
({SpatialToolbarActions:Actions}=await server.ssrLoadModule(new URL('../../../packages/spatial-ui/src/SpatialToolbarActions.tsx',import.meta.url).pathname));
});
after(async()=>{await server?.close();});
test('scene tools use the bounded modeless window with move, resize and expand controls',()=>{
const html=renderToStaticMarkup(createElement(Tool,{boundsRef:{current:null},title:'Слои',onClose:()=>{}},'CONTROLS'));
assert.match(html,/nodedc-workspace-window/);
assert.match(html,/aria-modal="false"/);
assert.match(html,/Переместить инструмент/);
assert.match(html,/Изменить размер инструмента/);
assert.match(html,/Развернуть инструмент/);
assert.doesNotMatch(html,/nodedc-overlay/);
});
test('spatial toolbar omits source and duplicate planning navigation',()=>{
const html=renderToStaticMarkup(createElement(Actions,{openLayers:()=>{},openDisplay:()=>{},activeTool:'layers'}));
assert.match(html,/Слои/);assert.match(html,/Отображение/);
assert.match(html,/aria-pressed="true"/);assert.doesNotMatch(html,/Движок|Планирование/);
const workspace=readFileSync(new URL('../src/workspaces/missions/PlanningSpatialWorkspace.tsx',import.meta.url),'utf8');
assert.doesNotMatch(workspace,/<Window\s|openSource=|openView\('mission-planner'\)/);
assert.match(workspace,/tools:boundsRef=>tool&&<PlanningSceneToolWindow/);
const viewer=readFileSync(new URL('../src/components/missions/PlanningLiveScene.tsx',import.meta.url),'utf8');
assert.match(viewer,/\},\[runId,retry\]\)/); // Presentation never owns viewer lifetime.
});