推进 INI 面板状态 report JSON 导出 helper

This commit is contained in:
2026-06-14 22:18:26 +08:00
parent 404cb1344c
commit 25268404cb
6 changed files with 186 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ import {
createIniPanelStateSummary,
createMachineSessionStateSnapshot,
createMachineSessionStateReport,
createMachineSessionStateReportExport,
} from "../../../runtime/ui/ini-panel/panel-state-summary.js";
const summary = createIniPanelStateSummary({
@@ -268,4 +269,65 @@ assert.deepEqual(
},
);
const expectedExportReport = {
readiness: {
ini: "INI WASM: ready",
interp: "Interpreter WASM: ready",
opfs: "OPFS: ready",
},
session: {
snapshotLabel: "ui-machine-session/ui-machine-session.json",
workflow: null,
ini: "/work/session-machine.ini",
parameters: null,
toolTable: null,
gcode: null,
},
loaded: {
iniWasmPath: "/work/session-machine.ini",
parameterWasmPath: null,
toolTableWasmPath: null,
},
program: {
source: null,
opfsPath: null,
wasmPath: null,
},
run: {
status: null,
canonicalEventCount: 0,
motionSnapshotCount: 0,
iniWasmPath: null,
},
status: {
lastAction: "save-session-snapshot",
error: null,
fiveaxisRemap: null,
},
};
assert.deepEqual(
createMachineSessionStateReportExport({
badges: {
ini: "INI WASM: ready",
interp: "Interpreter WASM: ready",
opfs: "OPFS: ready",
},
fields: {
sessionSnapshot: "ui-machine-session/ui-machine-session.json",
sessionIni: "/work/session-machine.ini",
},
sessionLoad: {
iniWasmPath: "/work/session-machine.ini",
},
lastAction: "save-session-snapshot",
}),
{
filename: "machine-session-state-report.json",
mediaType: "application/json",
report: expectedExportReport,
text: `${JSON.stringify(expectedExportReport, null, 2)}\n`,
},
);
console.log("ini_panel_state_summary_node_smoke=ok");