Skip to content

Commit ba625e2

Browse files
committed
test: dedupe models command mock reads
1 parent f2b560f commit ba625e2

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/auto-reply/reply/commands-models.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@ function buildParams(
174174
} as unknown as HandleCommandsParams;
175175
}
176176

177+
function firstAuthCheckerParams() {
178+
return modelProviderAuthMocks.createProviderAuthChecker.mock.calls[0]?.[0];
179+
}
180+
177181
describe("handleModelsCommand", () => {
178182
it("shows a simple providers menu on text surfaces", async () => {
179183
const result = await handleModelsCommand(buildParams("/models"), true);
@@ -186,8 +190,7 @@ describe("handleModelsCommand", () => {
186190
expect(result?.reply?.text).toContain("Use: /models <provider>");
187191
expect(result?.reply?.text).toContain("Switch: /model <provider/model>");
188192
expect(result?.reply?.text).not.toContain("Add: /models add");
189-
const authCheckerParams =
190-
modelProviderAuthMocks.createProviderAuthChecker.mock.calls.at(0)?.[0];
193+
const authCheckerParams = firstAuthCheckerParams();
191194
expect(authCheckerParams?.workspaceDir).toBe("/tmp");
192195
});
193196

@@ -412,8 +415,7 @@ describe("handleModelsCommand", () => {
412415
const result = await handleModelsCommand(params, true);
413416

414417
expect(result?.reply?.text).toContain("- anthropic (2)");
415-
const authCheckerParams =
416-
modelProviderAuthMocks.createProviderAuthChecker.mock.calls.at(0)?.[0];
418+
const authCheckerParams = firstAuthCheckerParams();
417419
expect(authCheckerParams?.workspaceDir).toBe("/tmp/spawned-workspace");
418420
});
419421

0 commit comments

Comments
 (0)