mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-24 07:01:49 +00:00
fix(extensions): restore setup and catalog tests
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import type { ModelProviderConfig } from "../config/types.models.js";
|
||||
import {
|
||||
buildPairedProviderApiKeyCatalog,
|
||||
buildSingleProviderApiKeyCatalog,
|
||||
@@ -7,12 +8,12 @@ import {
|
||||
} from "./provider-catalog.js";
|
||||
import type { ProviderCatalogContext } from "./types.js";
|
||||
|
||||
function createProviderConfig(params?: { provider?: string; baseUrl?: string }) {
|
||||
function createProviderConfig(overrides: Partial<ModelProviderConfig> = {}): ModelProviderConfig {
|
||||
return {
|
||||
api: "openai-completions" as const,
|
||||
provider: params?.provider ?? "test-provider",
|
||||
baseUrl: params?.baseUrl ?? "https://default.example/v1",
|
||||
api: "openai-completions",
|
||||
baseUrl: "https://default.example/v1",
|
||||
models: [],
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -67,7 +68,6 @@ describe("buildSingleProviderApiKeyCatalog", () => {
|
||||
api: "openai-completions",
|
||||
baseUrl: "https://default.example/v1",
|
||||
models: [],
|
||||
provider: "test-provider",
|
||||
apiKey: "secret-key",
|
||||
},
|
||||
});
|
||||
@@ -89,10 +89,7 @@ describe("buildSingleProviderApiKeyCatalog", () => {
|
||||
},
|
||||
}),
|
||||
providerId: "test-provider",
|
||||
buildProvider: () => ({
|
||||
...createProviderConfig(),
|
||||
baseUrl: "https://default.example/v1",
|
||||
}),
|
||||
buildProvider: () => createProviderConfig(),
|
||||
allowExplicitBaseUrl: true,
|
||||
});
|
||||
|
||||
@@ -101,7 +98,6 @@ describe("buildSingleProviderApiKeyCatalog", () => {
|
||||
api: "openai-completions",
|
||||
baseUrl: "https://override.example/v1/",
|
||||
models: [],
|
||||
provider: "test-provider",
|
||||
apiKey: "secret-key",
|
||||
},
|
||||
});
|
||||
@@ -114,8 +110,8 @@ describe("buildSingleProviderApiKeyCatalog", () => {
|
||||
}),
|
||||
providerId: "test-provider",
|
||||
buildProviders: async () => ({
|
||||
alpha: createProviderConfig({ provider: "alpha" }),
|
||||
beta: createProviderConfig({ provider: "beta" }),
|
||||
alpha: createProviderConfig(),
|
||||
beta: createProviderConfig(),
|
||||
}),
|
||||
});
|
||||
|
||||
@@ -125,14 +121,12 @@ describe("buildSingleProviderApiKeyCatalog", () => {
|
||||
api: "openai-completions",
|
||||
baseUrl: "https://default.example/v1",
|
||||
models: [],
|
||||
provider: "alpha",
|
||||
apiKey: "secret-key",
|
||||
},
|
||||
beta: {
|
||||
api: "openai-completions",
|
||||
baseUrl: "https://default.example/v1",
|
||||
models: [],
|
||||
provider: "beta",
|
||||
apiKey: "secret-key",
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user