mirror of
https://github.com/moltbot/moltbot.git
synced 2026-03-30 01:06:11 +00:00
fix(extensions): restore setup and catalog tests
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { normalizeSignalAccountInput, parseSignalAllowFromEntries } from "./setup-surface.js";
|
||||
import { normalizeSignalAccountInput, parseSignalAllowFromEntries } from "./setup-core.js";
|
||||
|
||||
describe("normalizeSignalAccountInput", () => {
|
||||
it("normalizes valid E.164 numbers", () => {
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
import {
|
||||
DEFAULT_ACCOUNT_ID,
|
||||
detectBinary,
|
||||
formatCliCommand,
|
||||
formatDocsLink,
|
||||
installSignalCli,
|
||||
type OpenClawConfig,
|
||||
parseSetupEntriesAllowingWildcard,
|
||||
promptParsedAllowFromForScopedChannel,
|
||||
setChannelDmPolicyWithAllowFrom,
|
||||
setSetupChannelEnabled,
|
||||
|
||||
@@ -41,6 +41,10 @@ import { collectWhatsAppStatusIssues } from "./status-issues.js";
|
||||
|
||||
const meta = getChatChannelMeta("whatsapp");
|
||||
|
||||
async function loadWhatsAppChannelRuntime() {
|
||||
return await import("./channel.runtime.js");
|
||||
}
|
||||
|
||||
function normalizeWhatsAppPayloadText(text: string | undefined): string {
|
||||
return (text ?? "").replace(/^(?:[ \t]*\r?\n)+/, "");
|
||||
}
|
||||
|
||||
@@ -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