droboticflow/tests/frontend/workflow-replay-layout.test.mjs

23 lines
1.3 KiB
JavaScript

import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
import test from "node:test";
const workflowEditorURL = new URL("../../src/pages/WorkflowEditor.tsx", import.meta.url);
test("read-only run replay permits temporary node layout without structural mutation or persistence", async () => {
const source = await readFile(workflowEditorURL, "utf8");
assert.match(source, /const canTemporarilyReposition = routeReadOnly \|\| editorLockState\.reason === "released";/);
assert.match(source, /const canRepositionGraph = canMutateGraph \|\| canTemporarilyReposition;/);
assert.match(source, /allowedCanvasChanges\(changes, canMutateGraph, canRepositionGraph\)/);
assert.match(source, /nodesDraggable=\{canRepositionGraph\}/);
assert.match(source, /nodesConnectable=\{canMutateGraph\}/);
assert.match(source, /edgesUpdatable=\{canMutateGraph\}/);
assert.match(source, /deleteKeyCode=\{null\}/);
assert.match(source, /if \(!editorLoadedRef\.current \|\| isReadOnly \|\| !canManage/);
assert.match(source, /blocked=\{isReadOnly \|\| hasBlockingGraphIssue\}/);
assert.match(source, /disabled=\{isReadOnly \|\| !hasCanvasSelection\}/);
assert.match(source, /只读回放:可临时拖动节点查看连线/);
assert.match(source, /定义 v\$\{workflowEntity\?\.definitionVersion \|\| 1\} 已发布 · 可临时排版/);
});