























@@ -1,4 +1,4 @@
1-import { beforeEach, describe, expect, it, vi } from "vitest";
1+import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
22import { jsonResult } from "../../agents/tools/common.js";
33import type { ChannelPlugin } from "../../channels/plugins/types.js";
44import { setActivePluginRegistry } from "../../plugins/runtime.js";
@@ -76,6 +76,12 @@ vi.mock("../../config/plugin-auto-enable.js", () => ({
76767777vi.mock("../../plugins/loader.js", () => ({
7878loadOpenClawPlugins: mocks.loadOpenClawPlugins,
79+resolveRuntimePluginRegistry: vi.fn(),
80+}));
81+82+vi.mock("../../infra/outbound/channel-bootstrap.runtime.js", () => ({
83+bootstrapOutboundChannelPlugin: vi.fn(),
84+resetOutboundChannelBootstrapStateForTests: vi.fn(),
7985}));
80868187vi.mock("../../infra/outbound/targets.js", () => ({
@@ -106,8 +112,7 @@ vi.mock("../../config/sessions.js", async () => {
106112};
107113});
108114109-async function loadFreshSendHandlersForTest() {
110-vi.resetModules();
115+async function loadSendHandlersForTest() {
111116({ sendHandlers } = await import("./send.js"));
112117}
113118@@ -194,6 +199,10 @@ function mockDeliverySuccess(messageId: string) {
194199describe("gateway send mirroring", () => {
195200let registrySeq = 0;
196201202+beforeAll(async () => {
203+await loadSendHandlersForTest();
204+});
205+197206beforeEach(async () => {
198207vi.clearAllMocks();
199208registrySeq += 1;
@@ -218,7 +227,6 @@ describe("gateway send mirroring", () => {
218227});
219228mocks.sendPoll.mockResolvedValue({ messageId: "poll-1" });
220229mocks.getChannelPlugin.mockReturnValue({ outbound: { sendPoll: mocks.sendPoll } });
221-await loadFreshSendHandlersForTest();
222230});
223231224232it("accepts media-only sends without message", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。