Files
NODEDC_MISSION_CORE/apps/control-station/test/planningPresentationTelemetry.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

32 lines
1.6 KiB
JavaScript

import assert from 'node:assert/strict';
import {before,after,test} from 'node:test';
import {createServer} from 'vite';
let server,createReporter;
before(async()=>{
server=await createServer({appType:'custom',logLevel:'silent',server:{middlewareMode:true}});
({createPlanningPresentationReporter:createReporter}=await server.ssrLoadModule(
'/src/core/missions/planningPresentationTelemetry.ts'));
});
after(async()=>{await server?.close();});
const settle=()=>new Promise(resolve=>setImmediate(resolve));
test('presentation observations batch separately from the scene channel and retain the proxy boundary',async()=>{
let timer,posted;
const reporter=createReporter({url:'/observations',schedule:callback=>{timer=callback;return 1;},cancel:()=>{},
fetcher:async(url,init)=>{posted={url,init};return new Response(null,{status:204});},
});
reporter.record({presentation:'live',cloudAgeMs:200,fitAgeMs:100,requestMs:40,
cloudRevision:3,cloudSequence:4,displayEpoch:'5d8c5d13-dfde-4ab6-9da0-475ab1f22c12'},
{rerunAdmissionMs:2,firstAnimationFrameMs:12,secondAnimationFrameMs:28});
assert.ok(timer);timer();await settle();
assert.equal(posted.url,'/observations');
const body=JSON.parse(posted.init.body);
assert.equal(body.schema_version,'missioncore.planning-browser-presentation/v1');
assert.deepEqual(body.samples,[{cloud_revision:3,cloud_sequence:4,
display_epoch:'5d8c5d13-dfde-4ab6-9da0-475ab1f22c12',request_ms:40,
rerun_admission_ms:2,first_animation_frame_ms:12,second_animation_frame_ms:28,
frame_timeout:false,source_to_second_animation_frame_upper_bound_ms:270}]);
reporter.dispose();
});