From 1a4917c3d3ac23b75b770c4151c0c0039c51474f Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 20 Apr 2026 21:23:10 +0100 Subject: [PATCH] test: mock web channel runtime boundary --- .../auto-reply/trigger-handling-test-harness.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/test/helpers/auto-reply/trigger-handling-test-harness.ts b/test/helpers/auto-reply/trigger-handling-test-harness.ts index fdac3c99da1..7f3c451cd1c 100644 --- a/test/helpers/auto-reply/trigger-handling-test-harness.ts +++ b/test/helpers/auto-reply/trigger-handling-test-harness.ts @@ -7,7 +7,6 @@ import { clearRuntimeAuthProfileStoreSnapshots } from "../../../src/agents/auth- import { withFastReplyConfig } from "../../../src/auto-reply/reply/get-reply-fast-path.js"; import type { OpenClawConfig } from "../../../src/config/types.openclaw.js"; import { resetProviderRuntimeHookCacheForTest } from "../../../src/plugins/provider-runtime.js"; -import { resolveRelativeBundledPluginPublicModuleId } from "../../../src/test-utils/bundled-plugin-public-surface.js"; // Avoid exporting vitest mock types (TS2742 under pnpm + d.ts emit). type AnyMock = any; @@ -164,17 +163,16 @@ const webSessionMocks = getSharedMocks("openclaw.trigger-handling.web-session-mo readWebSelfId: vi.fn().mockReturnValue({ e164: "+1999" }), })); -const whatsappRuntimeApiModuleId = resolveRelativeBundledPluginPublicModuleId({ - fromModuleUrl: import.meta.url, - pluginId: "whatsapp", - artifactBasename: "runtime-api.js", -}); - export function getWebSessionMocks(): AnyMocks { return webSessionMocks; } -const installWebSessionMock = () => vi.doMock(whatsappRuntimeApiModuleId, () => webSessionMocks); +const installWebSessionMock = () => + vi.doMock("../../../src/plugins/runtime/runtime-web-channel-plugin.js", () => ({ + webAuthExists: (...args: unknown[]) => webSessionMocks.webAuthExists(...args), + getWebAuthAgeMs: (...args: unknown[]) => webSessionMocks.getWebAuthAgeMs(...args), + readWebSelfId: (...args: unknown[]) => webSessionMocks.readWebSelfId(...args), + })); installWebSessionMock();