mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 06:40:44 +00:00
test: tighten model list auth fixtures
This commit is contained in:
@@ -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")],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -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,
|
||||
}),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user