diff --git a/src/infra/outbound/message-action-runner.test-helpers.ts b/src/infra/outbound/message-action-runner.test-helpers.ts index 70dfd495b26c..56d585df2134 100644 --- a/src/infra/outbound/message-action-runner.test-helpers.ts +++ b/src/infra/outbound/message-action-runner.test-helpers.ts @@ -17,7 +17,9 @@ import { createTestRegistry } from "../../test-utils/channel-plugins.js"; type ChannelActionHandler = NonNullable["handleAction"]>; -export const messageActionRunnerMocks = { +// Create shared bindings before mock factories run so non-isolated tests reset +// and assert against the same functions that the production imports receive. +const hoistedMessageActionRunnerMocks = vi.hoisted(() => ({ resolveOutboundChannelPlugin: vi.fn(), executeSendAction: vi.fn(), executePollAction: vi.fn(), @@ -36,7 +38,9 @@ export const messageActionRunnerMocks = { isDeliveredCurrentSourceReplyAction: vi.fn(() => false), reconcileTerminalSourceReplyDelivery: vi.fn(), loadWebMedia: vi.fn(), -}; +})); + +export const messageActionRunnerMocks = hoistedMessageActionRunnerMocks; vi.mock("./channel-resolution.js", () => ({ normalizeDeliverableOutboundChannel: (value?: string | null) =>