mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-18 17:44:45 +00:00
test: dedupe model fallback mock reads
This commit is contained in:
@@ -328,12 +328,10 @@ function mockPrimaryRunLoopRateLimitThenFallbackSuccess(errorMessage: string) {
|
||||
|
||||
function expectOpenAiThenGroqAttemptOrder(params?: { expectOpenAiAuthProfileId?: string }) {
|
||||
expect(runEmbeddedAttemptMock).toHaveBeenCalledTimes(2);
|
||||
const firstCall = runEmbeddedAttemptMock.mock.calls.at(0)?.[0] as
|
||||
const firstCall = runEmbeddedAttemptMock.mock.calls[0]?.[0] as
|
||||
| { provider?: string; authProfileId?: string }
|
||||
| undefined;
|
||||
const secondCall = runEmbeddedAttemptMock.mock.calls.at(1)?.[0] as
|
||||
| { provider?: string }
|
||||
| undefined;
|
||||
const secondCall = runEmbeddedAttemptMock.mock.calls[1]?.[0] as { provider?: string } | undefined;
|
||||
if (!firstCall || !secondCall) {
|
||||
throw new Error("expected primary and fallback embedded run attempts");
|
||||
}
|
||||
@@ -704,7 +702,7 @@ describe("runWithModelFallback + runEmbeddedPiAgent failover behavior", () => {
|
||||
expect((thrown as Error).message).toBe("Operation aborted");
|
||||
|
||||
expect(runEmbeddedAttemptMock).toHaveBeenCalledTimes(1);
|
||||
const firstCall = runEmbeddedAttemptMock.mock.calls.at(0)?.[0] as
|
||||
const firstCall = runEmbeddedAttemptMock.mock.calls[0]?.[0] as
|
||||
| { provider?: string }
|
||||
| undefined;
|
||||
expect(firstCall?.provider).toBe("openai");
|
||||
|
||||
Reference in New Issue
Block a user