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,/tool&&