mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-13 10:59:39 +00:00
test: dedupe batch http mock read
This commit is contained in:
parent
06045b578a
commit
20ec18807c
1 changed files with 3 additions and 2 deletions
|
|
@ -33,7 +33,8 @@ function requirePostJsonParams(
|
|||
return params;
|
||||
}
|
||||
|
||||
function requireRetryOptions(call: unknown[] | undefined): RetryOptions {
|
||||
function requireFirstRetryOptions(retryAsyncMock: ReturnType<typeof vi.fn>): RetryOptions {
|
||||
const call = retryAsyncMock.mock.calls[0];
|
||||
const options = call?.[1] as RetryOptions | undefined;
|
||||
if (!options) {
|
||||
throw new Error("expected retry options");
|
||||
|
|
@ -78,7 +79,7 @@ describe("postJsonWithRetry", () => {
|
|||
expect(postJsonParams.errorPrefix).toBe("memory batch failed");
|
||||
expect(postJsonParams.attachStatus).toBe(true);
|
||||
|
||||
const retryOptions = requireRetryOptions(retryAsyncMock.mock.calls.at(0));
|
||||
const retryOptions = requireFirstRetryOptions(retryAsyncMock);
|
||||
expect(retryOptions.attempts).toBe(3);
|
||||
expect(retryOptions.minDelayMs).toBe(300);
|
||||
expect(retryOptions.maxDelayMs).toBe(2000);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue