From ba625e2cff29d656877912673ef2ada430863d76 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 13 May 2026 00:18:15 +0100 Subject: [PATCH] test: dedupe models command mock reads --- src/auto-reply/reply/commands-models.test.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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"); });