Files
openclaw/src/secrets/runtime-telegram.test-support.ts
2026-07-14 02:38:46 -07:00

29 lines
1.0 KiB
TypeScript

/** Test bootstrap shim for Telegram runtime-secret surface coverage. */
import { vi } from "vitest";
import { loadChannelSecretContractApi } from "./channel-contract-api.js";
/** Test-only bootstrap registry mock for Telegram secret surface tests. */
const telegramSecrets = loadChannelSecretContractApi({ channelId: "telegram", config: {} });
if (!telegramSecrets?.collectRuntimeConfigAssignments) {
throw new Error("Missing Telegram secret contract api");
}
const telegramAssignments = telegramSecrets.collectRuntimeConfigAssignments;
// Use the real bundled Telegram secret contract while avoiding plugin bootstrap.
vi.mock("../channels/plugins/bootstrap-registry.js", () => ({
getBootstrapChannelPlugin: (id: string) =>
id === "telegram"
? {
secrets: {
collectRuntimeConfigAssignments: telegramAssignments,
},
}
: undefined,
getBootstrapChannelSecrets: (id: string) =>
id === "telegram"
? {
collectRuntimeConfigAssignments: telegramAssignments,
}
: undefined,
}));