按规划继续工作
结论:补齐 OPFS 会话快照自定义文件名与非法快照文件名拒绝验证,覆盖 Node OPFS 与 Chromium OPFS 路径,并通过 host/WASM/browser 聚合验证。
This commit is contained in:
@@ -104,6 +104,10 @@ assert.equal(parameterFilePath("xyzab-tdr"), "linuxcnc/machines/xyzab-tdr/linuxc
|
||||
assert.equal(gcodeProgramPath("fixture.ngc"), "linuxcnc/gcode/fixture.ngc");
|
||||
assert.equal(previewCachePath("fixture"), "linuxcnc/preview-cache/fixture/preview.json");
|
||||
assert.equal(sessionSnapshotPath("session-1"), "linuxcnc/sessions/session-1/snapshot.json");
|
||||
assert.equal(
|
||||
sessionSnapshotPath("session-1", "custom-snapshot.json"),
|
||||
"linuxcnc/sessions/session-1/custom-snapshot.json",
|
||||
);
|
||||
assert.deepEqual(defaultMachinePaths("xyzab-tdr"), {
|
||||
ini: "linuxcnc/machines/xyzab-tdr/machine.ini",
|
||||
toolTable: "linuxcnc/machines/xyzab-tdr/tool.tbl",
|
||||
@@ -167,6 +171,23 @@ await saveSessionSnapshot("session-1", snapshotPayload, {
|
||||
metadata: { source: "node-smoke" },
|
||||
});
|
||||
assert.deepEqual(await loadSessionSnapshot("session-1", { storage }), snapshot);
|
||||
const customSnapshot = await saveSessionSnapshot("session-1", snapshotPayload, {
|
||||
storage,
|
||||
filename: "custom-snapshot.json",
|
||||
createdAt: "2026-06-08T00:00:00.000Z",
|
||||
metadata: { source: "node-smoke-custom" },
|
||||
});
|
||||
assert.equal(
|
||||
customSnapshot.metadata.source,
|
||||
"node-smoke-custom",
|
||||
);
|
||||
assert.deepEqual(
|
||||
await loadSessionSnapshot("session-1", {
|
||||
storage,
|
||||
filename: "custom-snapshot.json",
|
||||
}),
|
||||
customSnapshot,
|
||||
);
|
||||
|
||||
await saveMachineTextFiles("xyzab-tdr", {
|
||||
ini: "[EMC]\nMACHINE = xyzab-tdr\n",
|
||||
@@ -569,6 +590,24 @@ assert.throws(
|
||||
() => machineIniPath("../escape"),
|
||||
/Invalid machine id/,
|
||||
);
|
||||
assert.throws(
|
||||
() => sessionSnapshotPath("session-1", "nested/snapshot.json"),
|
||||
/Invalid session snapshot filename/,
|
||||
);
|
||||
await assert.rejects(
|
||||
() => saveSessionSnapshot("session-1", {}, {
|
||||
storage,
|
||||
filename: "nested/snapshot.json",
|
||||
}),
|
||||
/Invalid session snapshot filename/,
|
||||
);
|
||||
await assert.rejects(
|
||||
() => loadSessionSnapshot("session-1", {
|
||||
storage,
|
||||
filename: "../snapshot.json",
|
||||
}),
|
||||
/Invalid session snapshot filename/,
|
||||
);
|
||||
await assert.rejects(
|
||||
() => saveMachineTextFiles("xyzab-tdr", null, { storage }),
|
||||
/machine files must be a plain object/,
|
||||
|
||||
Reference in New Issue
Block a user