76 lines
3.2 KiB
JavaScript
76 lines
3.2 KiB
JavaScript
import assert from "node:assert/strict";
|
|
|
|
import {
|
|
createGmoccapyCommunicationSummary,
|
|
gmoccapyCommunicationModel,
|
|
} from "../../app/src/runtime/gmoccapy-communication-model.js";
|
|
|
|
const model = gmoccapyCommunicationModel;
|
|
|
|
assert.equal(model.apiName, "web-rtcp-5axis-gmoccapy-communication-model");
|
|
assert.equal(model.profileId, "gmoccapy-xyzab");
|
|
assert.equal(model.nativeConfigPath.endsWith("gmoccapy_XYZAB.ini"), true);
|
|
assert.equal(model.cycleTimeMs, 100);
|
|
assert.equal(model.semanticBoundary, "native_gmoccapy_nml_hal_reference_web_store_runtime_mapping");
|
|
|
|
assert.deepEqual(model.nativePaths.command.path, ["gmoccapy", "linuxcnc.command()", "NML emcCommand", "milltask"]);
|
|
assert.equal(model.nativePaths.status.path.includes("linuxcnc.stat()"), true);
|
|
assert.equal(model.nativePaths.status.path.includes("linuxcnc.error_channel()"), true);
|
|
assert.equal(model.nativePaths.hal.path.includes("HAL shared memory"), true);
|
|
assert.equal(model.nativePaths.remap.path.includes("Python remap prolog/ngc/epilog"), true);
|
|
assert.deepEqual(model.webPath.path, ["button", "store.dispatch", "linuxcnc-task-policy", "runtime/status snapshot", "UI/Three.js"]);
|
|
|
|
assert.equal(model.startupStages.length, 9);
|
|
assert.equal(model.startupStages[0].id, "parse-ini");
|
|
assert.equal(model.startupStages.at(-1).id, "postgui");
|
|
assert.equal(model.startupStages.at(-1).nativeStep.includes("halcomp.ready()"), true);
|
|
|
|
const actionIds = model.actionMappings.map((mapping) => mapping.actionId);
|
|
for (const actionId of [
|
|
"estop",
|
|
"estop-reset",
|
|
"power-on",
|
|
"mode-manual",
|
|
"mode-mdi",
|
|
"mode-auto",
|
|
"jog",
|
|
"home",
|
|
"mdi",
|
|
"auto-run",
|
|
"auto-pause",
|
|
"auto-resume",
|
|
"abort",
|
|
"spindle",
|
|
"coolant",
|
|
]) {
|
|
assert.equal(actionIds.includes(actionId), true, `${actionId} missing`);
|
|
}
|
|
|
|
const runMapping = model.actionMappings.find((mapping) => mapping.actionId === "auto-run");
|
|
assert.equal(runMapping.nativeCommand, "command.auto(AUTO_RUN, start_line)");
|
|
assert.equal(runMapping.webAction, "RUN");
|
|
assert.equal(runMapping.gate.includes("INI loaded"), true);
|
|
assert.equal(runMapping.gate.includes("runtime ready"), true);
|
|
|
|
const jogMapping = model.actionMappings.find((mapping) => mapping.actionId === "jog");
|
|
assert.equal(jogMapping.nativeCommand.includes("JOG_CONTINUOUS"), true);
|
|
assert.equal(jogMapping.gate, "machine on, manual mode, not running");
|
|
|
|
const spindleMapping = model.actionMappings.find((mapping) => mapping.actionId === "spindle");
|
|
assert.equal(spindleMapping.nativeStatus.includes("spindle.0.forward"), true);
|
|
assert.equal(spindleMapping.gate.includes("restricted during interpreter"), true);
|
|
|
|
const summary = createGmoccapyCommunicationSummary(model);
|
|
assert.equal(summary.apiName, "web-rtcp-5axis-gmoccapy-communication-model-summary");
|
|
assert.equal(summary.profileId, "gmoccapy-xyzab");
|
|
assert.equal(summary.nativePathCount, 4);
|
|
assert.equal(summary.startupStageCount, 9);
|
|
assert.equal(summary.actionCount, 15);
|
|
assert.equal(summary.postguiAfterHalcompReady, true);
|
|
assert.equal(summary.hasNativeNmlCommandPath, true);
|
|
assert.equal(summary.hasNativeHalPath, true);
|
|
assert.equal(summary.hasWebStorePath, true);
|
|
assert.equal(summary.semanticBoundary, model.semanticBoundary);
|
|
|
|
console.log("gmoccapy_communication_model_smoke=ok");
|