Files
NODEDC_MISSION_CORE/apps/control-station/test/roverConfiguration.test.mjs
T
DCCONSTRUCTIONS 70ef3f9f1c chore(storage): bound build retention, caches and test resources
Track build ownership, qualified pins and bounded cache/log lifecycles. Move Vite fixtures to a job-owned server helper and preserve private outputs outside Git.
2026-10-29 09:09:58 +03:00

20 lines
1.2 KiB
JavaScript

import assert from 'node:assert/strict';
import {before,after,test} from 'node:test';
import {createServer} from './support/vite-server.mjs';
let server,sameConfiguration;
before(async()=>{server=await createServer({appType:'custom',logLevel:'silent',server:{middlewareMode:true}});({sameConfiguration}=await server.ssrLoadModule('/src/core/fleet/configurationEquality.ts'));});
after(async()=>server?.close());
test('lost onboard acknowledgement reconciles across JSON key ordering',()=>{
const draft={cameras:{x4:{rotations:{left:90,right:270},panoramaYaw:15}},layouts:{version:1,presets:[]}};
const board={layouts:{presets:[],version:1},cameras:{x4:{panoramaYaw:15,rotations:{right:270,left:90}}}};
assert.equal(sameConfiguration(draft,board),true);
board.cameras.x4.rotations.left=180;
assert.equal(sameConfiguration(draft,board),false);
});
test('array order and absent fields remain meaningful configuration changes',()=>{
assert.equal(sameConfiguration({order:['left','right']},{order:['right','left']}),false);
assert.equal(sameConfiguration({yaw:0},{}),false);
assert.equal(sameConfiguration({yaw:0},{yaw:null}),false);
assert.equal(sameConfiguration(null,{}),false);
});