From be1037fd345350e792d32e4a52afa0f99b6eb67c Mon Sep 17 00:00:00 2001 From: Shakker Date: Wed, 29 Apr 2026 17:00:43 +0100 Subject: [PATCH] test: tighten model list auth fixtures --- src/commands/models/list.auth-index.test.ts | 16 ++++++++++++++-- src/commands/models/list.rows.ts | 4 ++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/commands/models/list.auth-index.test.ts b/src/commands/models/list.auth-index.test.ts index 797fe99591b..364e43667ec 100644 --- a/src/commands/models/list.auth-index.test.ts +++ b/src/commands/models/list.auth-index.test.ts @@ -11,6 +11,18 @@ const emptyStore: AuthProfileStore = { profiles: {}, }; +function modelConfig(id: string) { + return { + id, + name: id, + reasoning: false, + input: ["text" as const], + cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, + contextWindow: 8192, + maxTokens: 4096, + }; +} + describe("createModelListAuthIndex", () => { it("normalizes auth aliases from profiles", () => { const index = createModelListAuthIndex({ @@ -54,7 +66,7 @@ describe("createModelListAuthIndex", () => { api: "openai-completions", apiKey: "sk-configured", baseUrl: "https://custom.example/v1", - models: [{ id: "local-model" }], + models: [modelConfig("local-model")], }, }, }, @@ -74,7 +86,7 @@ describe("createModelListAuthIndex", () => { "local-openai": { api: "openai-completions", baseUrl: "http://127.0.0.1:8080/v1", - models: [{ id: "local-model" }], + models: [modelConfig("local-model")], }, }, }, diff --git a/src/commands/models/list.rows.ts b/src/commands/models/list.rows.ts index ade8af65f7e..84902065315 100644 --- a/src/commands/models/list.rows.ts +++ b/src/commands/models/list.rows.ts @@ -82,7 +82,7 @@ async function buildRow(params: { availableKeys: params.context.availableKeys, allowProviderAvailabilityFallback: params.allowProviderAvailabilityFallback ?? false, hasAuthForProvider: shouldResolveProviderAuth - ? params.context.authIndex.hasProviderAuth + ? (provider) => params.context.authIndex.hasProviderAuth(provider) : undefined, }); } @@ -466,7 +466,7 @@ export async function appendConfiguredRows(params: { ? !params.context.discoveredKeys.has(modelKey(model.provider, model.id)) : false, hasAuthForProvider: shouldResolveProviderAuth - ? params.context.authIndex.hasProviderAuth + ? (provider) => params.context.authIndex.hasProviderAuth(provider) : undefined, }), );