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.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
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/editorFiles.ts',import.meta.url),'utf8');
|
||||
const {validateProject,bytesBase64}=await import('data:text/javascript;base64,'+Buffer.from(ts.transpileModule(source,{compilerOptions:{module:ts.ModuleKind.ESNext,target:ts.ScriptTarget.ES2022}}).outputText).toString('base64'));
|
||||
test('Lisp project export preserves binary imports and UTF-8 source',()=>{
|
||||
const input={kind:'lisp',source:'(print "проверка")',imports:{'data.bin':bytesBase64(Uint8Array.from([0,255,1]))},fullscreen:false};
|
||||
assert.deepEqual(validateProject(JSON.parse(JSON.stringify(input)),'lisp'),input);
|
||||
assert.equal(atob(input.imports['data.bin']).charCodeAt(1),255);
|
||||
});
|
||||
test('code import rejects wrong kind, oversized source and unsafe attachment names',()=>{
|
||||
const p={kind:'lisp',source:'(+ 1 2)',imports:{},fullscreen:false};
|
||||
for(const value of [{...p,kind:'qml'},{...p,source:'x'.repeat(122881)},{...p,source:'x\0y'}, {...p,imports:{'../secret':'YQ=='}},{...p,imports:{'/secret':'YQ=='}},{...p,imports:{'a.bin':'!'}},{...p,imports:Array(2)}]) assert.throws(()=>validateProject(value,'lisp'));
|
||||
assert.throws(()=>validateProject({...p,kind:'qml',imports:{'a.bin':'YQ=='}},'qml'));
|
||||
});
|
||||
Reference in New Issue
Block a user