From 1990d2e76190ff6ee6c74f2a0978f67a5c7ed05a Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 6 Apr 2026 23:34:21 +0100 Subject: [PATCH] test(infra): update loaded outbound target mock --- src/infra/outbound/targets-loaded.test.ts | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/infra/outbound/targets-loaded.test.ts b/src/infra/outbound/targets-loaded.test.ts index ed284e91b49..c0691fcae84 100644 --- a/src/infra/outbound/targets-loaded.test.ts +++ b/src/infra/outbound/targets-loaded.test.ts @@ -3,30 +3,20 @@ import type { OpenClawConfig } from "../../config/config.js"; import { tryResolveLoadedOutboundTarget } from "./targets-loaded.js"; const mocks = vi.hoisted(() => ({ - getChannelPlugin: vi.fn(), - getActivePluginRegistry: vi.fn(), - getActivePluginChannelRegistry: vi.fn(), + getLoadedChannelPlugin: vi.fn(), })); vi.mock("../../channels/plugins/index.js", () => ({ - getChannelPlugin: mocks.getChannelPlugin, -})); - -vi.mock("../../plugins/runtime.js", () => ({ - getActivePluginRegistry: mocks.getActivePluginRegistry, - getActivePluginChannelRegistry: mocks.getActivePluginChannelRegistry, + getLoadedChannelPlugin: mocks.getLoadedChannelPlugin, })); describe("tryResolveLoadedOutboundTarget", () => { beforeEach(() => { - mocks.getChannelPlugin.mockReset(); - mocks.getActivePluginRegistry.mockReset(); - mocks.getActivePluginChannelRegistry.mockReset(); + mocks.getLoadedChannelPlugin.mockReset(); }); it("returns undefined when no loaded plugin exists", () => { - mocks.getChannelPlugin.mockReturnValue(undefined); - mocks.getActivePluginRegistry.mockReturnValue(null); + mocks.getLoadedChannelPlugin.mockReturnValue(undefined); expect(tryResolveLoadedOutboundTarget({ channel: "telegram", to: "123" })).toBeUndefined(); }); @@ -35,7 +25,7 @@ describe("tryResolveLoadedOutboundTarget", () => { const cfg: OpenClawConfig = { channels: { telegram: { defaultTo: "123456789" } }, }; - mocks.getChannelPlugin.mockReturnValue({ + mocks.getLoadedChannelPlugin.mockReturnValue({ id: "telegram", meta: { label: "Telegram" }, capabilities: {},