|
| 1 | +import assert from "node:assert/strict"; |
| 2 | +import { |
| 3 | + renderWorkflowTui, |
| 4 | + resolveWorkflowTuiWorkspaceRoot, |
| 5 | +} from "./workflow-tui.js"; |
| 6 | +import type { WorkflowProjectView } from "./workflow-view.js"; |
| 7 | + |
| 8 | +const project: WorkflowProjectView = { |
| 9 | + workspaceRoot: "/tmp/project", |
| 10 | + version: "1", |
| 11 | + runs: [ |
| 12 | + { |
| 13 | + id: "wfr_1", |
| 14 | + name: "Review auth", |
| 15 | + status: "running", |
| 16 | + source: "named", |
| 17 | + scriptPath: "/tmp/review.js", |
| 18 | + scriptHash: "abc", |
| 19 | + workspaceRoot: "/tmp/project", |
| 20 | + currentPhase: "Implementation", |
| 21 | + calls: { |
| 22 | + running: 1, |
| 23 | + completed: 1, |
| 24 | + cached: 0, |
| 25 | + failed: 0, |
| 26 | + cancelled: 0, |
| 27 | + observed: 2, |
| 28 | + }, |
| 29 | + phases: [ |
| 30 | + { |
| 31 | + title: "Implementation", |
| 32 | + calls: [ |
| 33 | + { |
| 34 | + callIndex: 1, |
| 35 | + status: "running", |
| 36 | + provider: "codex", |
| 37 | + label: "Patch auth", |
| 38 | + isolation: "worktree", |
| 39 | + fromCache: false, |
| 40 | + updatedAt: "2026-07-26T10:00:02.000Z", |
| 41 | + }, |
| 42 | + ], |
| 43 | + }, |
| 44 | + ], |
| 45 | + unphasedCalls: [], |
| 46 | + recentActivity: [ |
| 47 | + { |
| 48 | + seq: 1, |
| 49 | + type: "log", |
| 50 | + detail: "Running tests", |
| 51 | + createdAt: "2026-07-26T10:00:03.000Z", |
| 52 | + }, |
| 53 | + ], |
| 54 | + latestEventSeq: 1, |
| 55 | + version: "v1", |
| 56 | + createdAt: "2026-07-26T10:00:00.000Z", |
| 57 | + startedAt: "2026-07-26T10:00:00.000Z", |
| 58 | + updatedAt: "2026-07-26T10:00:03.000Z", |
| 59 | + }, |
| 60 | + ], |
| 61 | +}; |
| 62 | + |
| 63 | +const rendered = renderWorkflowTui(project, 0, 100, 30, { ansi: false }); |
| 64 | +assert.match(rendered, /DevSpace workflows · \/tmp\/project/); |
| 65 | +assert.match(rendered, /Review auth · Implementation/); |
| 66 | +assert.match(rendered, /Patch auth codex · worktree/); |
| 67 | +assert.match(rendered, /Running tests/); |
| 68 | +assert.match(rendered, /refreshes automatically/); |
| 69 | +assert.equal(resolveWorkflowTuiWorkspaceRoot("./test-project").endsWith("test-project"), true); |
| 70 | + |
| 71 | +console.log("workflow-tui.test.ts: ok"); |
0 commit comments