fix(extensions): restore setup and catalog tests

This commit is contained in:
Peter Steinberger
2026-03-16 21:30:50 -07:00
parent 4bba2888e7
commit 631f6f47cf
4 changed files with 13 additions and 17 deletions

View File

@@ -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", () => {

View File

@@ -1,11 +1,9 @@
import {
DEFAULT_ACCOUNT_ID,
detectBinary,
formatCliCommand,
formatDocsLink,
installSignalCli,
type OpenClawConfig,
parseSetupEntriesAllowingWildcard,
promptParsedAllowFromForScopedChannel,
setChannelDmPolicyWithAllowFrom,
setSetupChannelEnabled,

View File

@@ -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)+/, "");
}

View File

@@ -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",
},
},