test: mirror flow list json · openclaw/openclaw@8755c18
shakkernerd
·
2026-05-12
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -72,7 +72,7 @@ describe("flows commands", () => {
|
72 | 72 | updatedAt: 100, |
73 | 73 | }); |
74 | 74 | |
75 | | -createRunningTaskRun({ |
| 75 | +const childTask = createRunningTaskRun({ |
76 | 76 | runtime: "acp", |
77 | 77 | ownerKey: "agent:main:main", |
78 | 78 | scopeKind: "session", |
@@ -88,33 +88,39 @@ describe("flows commands", () => {
|
88 | 88 | const runtime = createRuntime(); |
89 | 89 | await flowsListCommand({ json: true, status: "blocked" }, runtime); |
90 | 90 | |
91 | | -const payload = JSON.parse(String(vi.mocked(runtime.log).mock.calls[0]?.[0])) as { |
92 | | -count: number; |
93 | | -status: string | null; |
94 | | -flows: Array<{ |
95 | | -flowId: string; |
96 | | -tasks: Array<{ runId?: string; label?: string }>; |
97 | | -taskSummary: { total: number; active: number }; |
98 | | -}>; |
99 | | -}; |
100 | | - |
101 | | -expect(payload.count).toBe(1); |
102 | | -expect(payload.status).toBe("blocked"); |
103 | | -expect(payload.flows).toStrictEqual([ |
104 | | -expect.objectContaining({ |
105 | | -flowId: flow.flowId, |
106 | | -taskSummary: expect.objectContaining({ |
107 | | -total: 1, |
108 | | -active: 1, |
109 | | -}), |
110 | | -tasks: [ |
111 | | -expect.objectContaining({ |
112 | | -runId: "run-child-1", |
113 | | -label: "Inspect PR 123", |
114 | | -}), |
115 | | -], |
116 | | -}), |
117 | | -]); |
| 91 | +const payload = JSON.parse(String(vi.mocked(runtime.log).mock.calls[0]?.[0])); |
| 92 | + |
| 93 | +expect(payload).toStrictEqual({ |
| 94 | +count: 1, |
| 95 | +status: "blocked", |
| 96 | +flows: [ |
| 97 | +{ |
| 98 | + ...JSON.parse(JSON.stringify(flow)), |
| 99 | +tasks: [JSON.parse(JSON.stringify(childTask))], |
| 100 | +taskSummary: { |
| 101 | +total: 1, |
| 102 | +active: 1, |
| 103 | +terminal: 0, |
| 104 | +failures: 0, |
| 105 | +byStatus: { |
| 106 | +queued: 0, |
| 107 | +running: 1, |
| 108 | +succeeded: 0, |
| 109 | +failed: 0, |
| 110 | +timed_out: 0, |
| 111 | +cancelled: 0, |
| 112 | +lost: 0, |
| 113 | +}, |
| 114 | +byRuntime: { |
| 115 | +subagent: 0, |
| 116 | +acp: 1, |
| 117 | +cli: 0, |
| 118 | +cron: 0, |
| 119 | +}, |
| 120 | +}, |
| 121 | +}, |
| 122 | +], |
| 123 | +}); |
118 | 124 | }); |
119 | 125 | }); |
120 | 126 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。