推进 INI 面板 session summary helper
This commit is contained in:
74
wasm-port/tests/ui/node/verify_ini_panel_session_summary.mjs
Normal file
74
wasm-port/tests/ui/node/verify_ini_panel_session_summary.mjs
Normal file
@@ -0,0 +1,74 @@
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
import {
|
||||
createSessionSnapshotSummary,
|
||||
sessionSnapshotMetadataLogLines,
|
||||
sessionSnapshotSummaryLogLines,
|
||||
} from "../../../runtime/ui/ini-panel/session-summary.js";
|
||||
|
||||
const snapshot = {
|
||||
metadata: {
|
||||
workflow: "save-session-snapshot",
|
||||
snapshotLabel: "ui-machine-session/ui-machine-session.json",
|
||||
defaultGcodeOpfsPath: "linuxcnc/gcode/ui-session.ngc",
|
||||
},
|
||||
payload: {
|
||||
files: {
|
||||
ini: "linuxcnc/machines/xyzab-tdr/machine.ini",
|
||||
parameters: "linuxcnc/machines/xyzab-tdr/linuxcnc.var",
|
||||
toolTable: "linuxcnc/machines/xyzab-tdr/tool.tbl",
|
||||
gcode: "linuxcnc/gcode/ui-session.ngc",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const summary = createSessionSnapshotSummary(snapshot);
|
||||
assert.deepEqual(summary, {
|
||||
snapshotLabel: "ui-machine-session/ui-machine-session.json",
|
||||
workflow: "save-session-snapshot",
|
||||
defaultGcodeOpfsPath: "linuxcnc/gcode/ui-session.ngc",
|
||||
iniOpfsPath: "linuxcnc/machines/xyzab-tdr/machine.ini",
|
||||
parameterOpfsPath: "linuxcnc/machines/xyzab-tdr/linuxcnc.var",
|
||||
toolTableOpfsPath: "linuxcnc/machines/xyzab-tdr/tool.tbl",
|
||||
gcodeOpfsPath: "linuxcnc/gcode/ui-session.ngc",
|
||||
});
|
||||
|
||||
assert.deepEqual(
|
||||
createSessionSnapshotSummary(snapshot, "override-session/override.json"),
|
||||
{
|
||||
...summary,
|
||||
snapshotLabel: "override-session/override.json",
|
||||
},
|
||||
);
|
||||
|
||||
assert.deepEqual(
|
||||
sessionSnapshotSummaryLogLines(summary),
|
||||
[
|
||||
"Snapshot: ui-machine-session/ui-machine-session.json",
|
||||
"Workflow: save-session-snapshot",
|
||||
"Default G-code: linuxcnc/gcode/ui-session.ngc",
|
||||
],
|
||||
);
|
||||
|
||||
assert.deepEqual(
|
||||
sessionSnapshotMetadataLogLines(summary),
|
||||
[
|
||||
"Workflow: save-session-snapshot",
|
||||
"Default G-code: linuxcnc/gcode/ui-session.ngc",
|
||||
],
|
||||
);
|
||||
|
||||
assert.deepEqual(
|
||||
createSessionSnapshotSummary(null),
|
||||
{
|
||||
snapshotLabel: null,
|
||||
workflow: null,
|
||||
defaultGcodeOpfsPath: null,
|
||||
iniOpfsPath: null,
|
||||
parameterOpfsPath: null,
|
||||
toolTableOpfsPath: null,
|
||||
gcodeOpfsPath: null,
|
||||
},
|
||||
);
|
||||
|
||||
console.log("ini_panel_session_summary_node_smoke=ok");
|
||||
6
wasm-port/tests/ui/node/verify_ini_panel_session_summary.sh
Executable file
6
wasm-port/tests/ui/node/verify_ini_panel_session_summary.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "$0")/../../.." && pwd)"
|
||||
|
||||
node "$ROOT_DIR/tests/ui/node/verify_ini_panel_session_summary.mjs"
|
||||
@@ -4,5 +4,6 @@ set -euo pipefail
|
||||
ROOT_DIR="$(cd "$(dirname "$0")/../../.." && pwd)"
|
||||
|
||||
"$ROOT_DIR/tests/ui/node/verify_ini_panel_run_summary.sh"
|
||||
"$ROOT_DIR/tests/ui/node/verify_ini_panel_session_summary.sh"
|
||||
|
||||
echo "ui_node_smokes=ok"
|
||||
|
||||
Reference in New Issue
Block a user