test: match task list json records · openclaw/openclaw@2959753
shakkernerd
·
2026-05-12
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -56,7 +56,7 @@ describe("tasks JSON commands", () => {
|
56 | 56 | |
57 | 57 | it("lists task records with runtime and status filters", async () => { |
58 | 58 | await withTaskJsonStateDir(async () => { |
59 | | -createTaskRecord({ |
| 59 | +const cliTask = createTaskRecord({ |
60 | 60 | runtime: "cli", |
61 | 61 | ownerKey: "agent:main:main", |
62 | 62 | scopeKind: "session", |
@@ -76,23 +76,12 @@ describe("tasks JSON commands", () => {
|
76 | 76 | const runtime = createRuntime(); |
77 | 77 | await tasksListJsonCommand({ json: true, runtime: "cli", status: "running" }, runtime); |
78 | 78 | |
79 | | -const payload = readJsonLog(runtime) as { |
80 | | -count: number; |
81 | | -runtime: string | null; |
82 | | -status: string | null; |
83 | | -tasks: Array<{ runtime: string; status: string; runId: string }>; |
84 | | -}; |
85 | | -expect(payload.count).toBe(1); |
86 | | -expect(payload.runtime).toBe("cli"); |
87 | | -expect(payload.status).toBe("running"); |
88 | | -expect(payload.tasks).toStrictEqual([ |
89 | | -expect.objectContaining({ |
90 | | -runtime: "cli", |
91 | | -status: "running", |
92 | | -runId: "run-cli", |
93 | | -task: "Inspect issue backlog", |
94 | | -}), |
95 | | -]); |
| 79 | +expect(readJsonLog(runtime)).toStrictEqual({ |
| 80 | +count: 1, |
| 81 | +runtime: "cli", |
| 82 | +status: "running", |
| 83 | +tasks: [JSON.parse(JSON.stringify(cliTask))], |
| 84 | +}); |
96 | 85 | }); |
97 | 86 | }); |
98 | 87 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。