mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 11:20:43 +00:00
test: share telegram api base mock
This commit is contained in:
@@ -21,6 +21,10 @@ const { resolveTelegramFetch } = vi.hoisted(() => ({
|
||||
resolveTelegramFetch: vi.fn(),
|
||||
}));
|
||||
|
||||
const resolveTelegramApiBase = vi.hoisted(
|
||||
() => (apiRoot?: string) => apiRoot?.trim()?.replace(/\/+$/, "") || "https://api.telegram.org",
|
||||
);
|
||||
|
||||
vi.mock("openclaw/plugin-sdk/config-runtime", async () => {
|
||||
const actual = await vi.importActual<typeof import("openclaw/plugin-sdk/config-runtime")>(
|
||||
"openclaw/plugin-sdk/config-runtime",
|
||||
@@ -37,8 +41,7 @@ vi.mock("./proxy.js", () => ({
|
||||
|
||||
vi.mock("./fetch.js", () => ({
|
||||
resolveTelegramFetch,
|
||||
resolveTelegramApiBase: (apiRoot?: string) =>
|
||||
apiRoot?.trim()?.replace(/\/+$/, "") || "https://api.telegram.org",
|
||||
resolveTelegramApiBase,
|
||||
}));
|
||||
|
||||
vi.mock("grammy", () => ({
|
||||
|
||||
Reference in New Issue
Block a user