test: tighten concurrency error callback assertion · openclaw/openclaw@a35a1f8
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -83,14 +83,15 @@ describe("runTasksWithConcurrency", () => {
|
83 | 83 | |
84 | 84 | it("continues after failures and reports the first one", async () => { |
85 | 85 | const firstErr = new Error("first"); |
| 86 | +const secondErr = new Error("second"); |
86 | 87 | const onTaskError = vi.fn(); |
87 | 88 | const tasks = [ |
88 | 89 | async () => { |
89 | 90 | throw firstErr; |
90 | 91 | }, |
91 | 92 | async () => 20, |
92 | 93 | async () => { |
93 | | -throw new Error("second"); |
| 94 | +throw secondErr; |
94 | 95 | }, |
95 | 96 | async () => 40, |
96 | 97 | ]; |
@@ -107,6 +108,6 @@ describe("runTasksWithConcurrency", () => {
|
107 | 108 | expect(result.results[3]).toBe(40); |
108 | 109 | expect(onTaskError).toHaveBeenCalledTimes(2); |
109 | 110 | expect(onTaskError).toHaveBeenNthCalledWith(1, firstErr, 0); |
110 | | -expect(onTaskError).toHaveBeenNthCalledWith(2, expect.any(Error), 2); |
| 111 | +expect(onTaskError).toHaveBeenNthCalledWith(2, secondErr, 2); |
111 | 112 | }); |
112 | 113 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。