From 7cb596c80736814e7872a2f96715d28d0da1efb4 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 13 May 2026 03:01:37 +0100 Subject: [PATCH] test: dedupe model fallback mock reads --- src/agents/model-fallback.run-embedded.e2e.test.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/agents/model-fallback.run-embedded.e2e.test.ts b/src/agents/model-fallback.run-embedded.e2e.test.ts index da6111a16d3..2c1fe0284cd 100644 --- a/src/agents/model-fallback.run-embedded.e2e.test.ts +++ b/src/agents/model-fallback.run-embedded.e2e.test.ts @@ -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");