diff --git a/src/auto-reply/reply/commands-models.test.ts b/src/auto-reply/reply/commands-models.test.ts index 867e56768f8..022a93b3f1c 100644 --- a/src/auto-reply/reply/commands-models.test.ts +++ b/src/auto-reply/reply/commands-models.test.ts @@ -174,6 +174,10 @@ function buildParams( } as unknown as HandleCommandsParams; } +function firstAuthCheckerParams() { + return modelProviderAuthMocks.createProviderAuthChecker.mock.calls[0]?.[0]; +} + describe("handleModelsCommand", () => { it("shows a simple providers menu on text surfaces", async () => { const result = await handleModelsCommand(buildParams("/models"), true); @@ -186,8 +190,7 @@ describe("handleModelsCommand", () => { expect(result?.reply?.text).toContain("Use: /models "); expect(result?.reply?.text).toContain("Switch: /model "); expect(result?.reply?.text).not.toContain("Add: /models add"); - const authCheckerParams = - modelProviderAuthMocks.createProviderAuthChecker.mock.calls.at(0)?.[0]; + const authCheckerParams = firstAuthCheckerParams(); expect(authCheckerParams?.workspaceDir).toBe("/tmp"); }); @@ -412,8 +415,7 @@ describe("handleModelsCommand", () => { const result = await handleModelsCommand(params, true); expect(result?.reply?.text).toContain("- anthropic (2)"); - const authCheckerParams = - modelProviderAuthMocks.createProviderAuthChecker.mock.calls.at(0)?.[0]; + const authCheckerParams = firstAuthCheckerParams(); expect(authCheckerParams?.workspaceDir).toBe("/tmp/spawned-workspace"); });