Files
NODEDC_MISSION_CORE/apps/control-station/test/vescFirmwareFiles.test.mjs
DCCONSTRUCTIONS f32c7b400b feat(vesc): extend motor diagnostics, configuration and transport recovery
Add firmware and extension catalogues, configuration transactions, sample review and QML diagnostics. Preserve explicit authority, bounded retries and stop recovery in motor transport.
2026-10-29 09:09:59 +03:00

16 lines
1.2 KiB
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import {readFileSync} from 'node:fs';
import ts from 'typescript';
const source=readFileSync(new URL('../../../plugins/vesc/frontend/src/firmwareFiles.ts',import.meta.url),'utf8');
const {firmwareFileError}=await import('data:text/javascript;base64,'+Buffer.from(ts.transpileModule(source,{compilerOptions:{module:ts.ModuleKind.ESNext,target:ts.ScriptTarget.ES2022}}).outputText).toString('base64'));
test('older engines do not offer HEX; supported files stay bounded before browser allocation',()=>{
assert.ok(firmwareFileError({name:'firmware.hex',size:1000},'firmware',['bin']));
assert.equal(firmwareFileError({name:'firmware.HEX',size:8*1024*1024},'firmware',['bin','hex']),null);
assert.ok(firmwareFileError({name:'firmware.hex',size:8*1024*1024+1},'firmware',['bin','hex']));
assert.ok(firmwareFileError({name:'firmware.zip',size:1000},'firmware',['bin','hex']));
assert.ok(firmwareFileError({name:'boot.bin',size:65537},'bootloader',['bin','hex']));
assert.equal(firmwareFileError({name:'boot.hex',size:100000},'bootloader',['bin','hex']),null);
assert.ok(firmwareFileError({name:'empty.bin',size:0},'firmware',['bin','hex']));
});