test: dedupe batch http mock read · openclaw/openclaw@20ec188
steipete
·
2026-05-13
·
via Recent Commits to openclaw:main
File tree
packages/memory-host-sdk/src/host
| Original file line number | Diff line number | Diff line change |
|---|
@@ -33,7 +33,8 @@ function requirePostJsonParams(
|
33 | 33 | return params; |
34 | 34 | } |
35 | 35 | |
36 | | -function requireRetryOptions(call: unknown[] | undefined): RetryOptions { |
| 36 | +function requireFirstRetryOptions(retryAsyncMock: ReturnType<typeof vi.fn>): RetryOptions { |
| 37 | +const call = retryAsyncMock.mock.calls[0]; |
37 | 38 | const options = call?.[1] as RetryOptions | undefined; |
38 | 39 | if (!options) { |
39 | 40 | throw new Error("expected retry options"); |
@@ -78,7 +79,7 @@ describe("postJsonWithRetry", () => {
|
78 | 79 | expect(postJsonParams.errorPrefix).toBe("memory batch failed"); |
79 | 80 | expect(postJsonParams.attachStatus).toBe(true); |
80 | 81 | |
81 | | -const retryOptions = requireRetryOptions(retryAsyncMock.mock.calls.at(0)); |
| 82 | +const retryOptions = requireFirstRetryOptions(retryAsyncMock); |
82 | 83 | expect(retryOptions.attempts).toBe(3); |
83 | 84 | expect(retryOptions.minDelayMs).toBe(300); |
84 | 85 | expect(retryOptions.maxDelayMs).toBe(2000); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。