diff --git a/extensions/slack/test-api.ts b/extensions/slack/test-api.ts index a36b24c73b9..da8eceb2bd2 100644 --- a/extensions/slack/test-api.ts +++ b/extensions/slack/test-api.ts @@ -1,4 +1,6 @@ export type { ResolvedSlackAccount } from "./src/accounts.js"; export type { SlackMessageEvent } from "./src/types.js"; +export { createSlackActions } from "./src/channel-actions.js"; export { prepareSlackMessage } from "./src/monitor/message-handler/prepare.js"; export { createInboundSlackTestContext } from "./src/monitor/message-handler/prepare.test-helpers.js"; +export { sendMessageSlack } from "./src/send.js"; diff --git a/extensions/telegram/test-api.ts b/extensions/telegram/test-api.ts index 8df8e5e5f65..fe5a421d2e2 100644 --- a/extensions/telegram/test-api.ts +++ b/extensions/telegram/test-api.ts @@ -1,3 +1,4 @@ export { buildTelegramMessageContextForTest } from "./src/bot-message-context.test-harness.js"; export { handleTelegramAction } from "./src/action-runtime.js"; +export { telegramMessageActionRuntime } from "./src/channel-actions.js"; export { sendMessageTelegram, sendPollTelegram, type TelegramApiOverride } from "./src/send.js"; diff --git a/src/auto-reply/reply.heartbeat-typing.test.ts b/src/auto-reply/reply.heartbeat-typing.test.ts index 3bfc5f635b3..4fddd0a5644 100644 --- a/src/auto-reply/reply.heartbeat-typing.test.ts +++ b/src/auto-reply/reply.heartbeat-typing.test.ts @@ -14,7 +14,7 @@ const webMocks = vi.hoisted(() => ({ readWebSelfId: vi.fn().mockReturnValue({ e164: "+1999" }), })); -vi.mock("../../extensions/whatsapp/src/session.js", () => webMocks); +vi.mock("../../extensions/whatsapp/runtime-api.js", () => webMocks); import { getReplyFromConfig } from "./reply.js"; diff --git a/src/channels/plugins/actions/actions.test.ts b/src/channels/plugins/actions/actions.test.ts index c672e5f393e..bcc34bd1e8a 100644 --- a/src/channels/plugins/actions/actions.test.ts +++ b/src/channels/plugins/actions/actions.test.ts @@ -17,11 +17,11 @@ const handleSlackAction = vi.hoisted(() => vi.fn(async (..._args: unknown[]) => let discordMessageActions: typeof import("../../../../extensions/discord/runtime-api.js").discordMessageActions; let handleDiscordMessageAction: typeof import("./discord/handle-action.js").handleDiscordMessageAction; let telegramMessageActions: typeof import("../../../../extensions/telegram/runtime-api.js").telegramMessageActions; -let signalMessageActions: typeof import("../../../../extensions/signal/src/message-actions.js").signalMessageActions; -let createSlackActions: typeof import("../../../../extensions/slack/src/channel-actions.js").createSlackActions; -let discordRuntimeModule: typeof import("../../../../extensions/discord/src/actions/runtime.js"); -let telegramChannelActionsModule: typeof import("../../../../extensions/telegram/src/channel-actions.js"); -let signalReactionModule: typeof import("../../../../extensions/signal/src/send-reactions.js"); +let signalMessageActions: typeof import("../../../../extensions/signal/api.js").signalMessageActions; +let createSlackActions: typeof import("../../../../extensions/slack/test-api.js").createSlackActions; +let discordRuntimeModule: typeof import("../../../../extensions/discord/runtime-api.js"); +let telegramTestApiModule: typeof import("../../../../extensions/telegram/test-api.js"); +let signalReactionModule: typeof import("../../../../extensions/signal/api.js"); function getDescribedActions(params: { describeMessageTool?: ChannelMessageActionAdapter["describeMessageTool"]; @@ -198,13 +198,12 @@ beforeAll(async () => { vi.resetModules(); ({ discordMessageActions } = await import("../../../../extensions/discord/runtime-api.js")); ({ handleDiscordMessageAction } = await import("./discord/handle-action.js")); - discordRuntimeModule = await import("../../../../extensions/discord/src/actions/runtime.js"); + discordRuntimeModule = await import("../../../../extensions/discord/runtime-api.js"); ({ telegramMessageActions } = await import("../../../../extensions/telegram/runtime-api.js")); - telegramChannelActionsModule = - await import("../../../../extensions/telegram/src/channel-actions.js"); - ({ signalMessageActions } = await import("../../../../extensions/signal/src/message-actions.js")); - signalReactionModule = await import("../../../../extensions/signal/src/send-reactions.js"); - ({ createSlackActions } = await import("../../../../extensions/slack/src/channel-actions.js")); + telegramTestApiModule = await import("../../../../extensions/telegram/test-api.js"); + ({ signalMessageActions } = await import("../../../../extensions/signal/api.js")); + signalReactionModule = await import("../../../../extensions/signal/api.js"); + ({ createSlackActions } = await import("../../../../extensions/slack/test-api.js")); }); beforeEach(() => { @@ -213,9 +212,8 @@ beforeEach(() => { vi.spyOn(discordRuntimeModule, "handleDiscordAction").mockImplementation( async (...args) => await handleDiscordAction(...args), ); - telegramChannelActionsModule.telegramMessageActionRuntime.handleTelegramAction = async ( - ...args - ) => await handleTelegramAction(...args); + telegramTestApiModule.telegramMessageActionRuntime.handleTelegramAction = async (...args) => + await handleTelegramAction(...args); vi.spyOn(signalReactionModule, "sendReactionSignal").mockImplementation( async (...args) => await sendReactionSignal(...args), ); diff --git a/src/channels/plugins/outbound/slack.test.ts b/src/channels/plugins/outbound/slack.test.ts index 7a13616bfbf..5f3e5202d85 100644 --- a/src/channels/plugins/outbound/slack.test.ts +++ b/src/channels/plugins/outbound/slack.test.ts @@ -1,7 +1,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import type { OpenClawConfig } from "../../../config/config.js"; -vi.mock("../../../../extensions/slack/src/send.js", () => ({ +vi.mock("../../../../extensions/slack/test-api.js", () => ({ sendMessageSlack: vi.fn().mockResolvedValue({ messageId: "1234.5678", channelId: "C123" }), })); @@ -10,7 +10,7 @@ vi.mock("openclaw/plugin-sdk/plugin-runtime", () => ({ })); import { getGlobalHookRunner } from "openclaw/plugin-sdk/plugin-runtime"; -import { sendMessageSlack } from "../../../../extensions/slack/src/send.js"; +import { sendMessageSlack } from "../../../../extensions/slack/test-api.js"; import { slackOutbound } from "../../../../test/channel-outbounds.js"; type SlackSendTextCtx = { diff --git a/src/commands/status.test.ts b/src/commands/status.test.ts index 6d119166389..a6d2ab2f99b 100644 --- a/src/commands/status.test.ts +++ b/src/commands/status.test.ts @@ -316,7 +316,7 @@ vi.mock("../channels/plugins/index.js", () => ({ }, ] as unknown, })); -vi.mock("../../extensions/whatsapp/src/session.js", () => ({ +vi.mock("../../extensions/whatsapp/runtime-api.js", () => ({ webAuthExists: mocks.webAuthExists, getWebAuthAgeMs: mocks.getWebAuthAgeMs, readWebSelfId: mocks.readWebSelfId,