test: stabilize outbound contract helpers

This commit is contained in:
Peter Steinberger
2026-04-06 23:53:14 +01:00
parent 6e482fc7cf
commit a690eafdf7

View File

@@ -1,4 +1,4 @@
import { expect, it, type Mock, vi } from "vitest";
import { beforeEach, expect, it, type Mock, vi } from "vitest";
import { createSlackOutboundPayloadHarness } from "../../../extensions/slack/contract-api.js";
import { whatsappOutbound } from "../../../extensions/whatsapp/test-api.js";
import {
@@ -10,6 +10,7 @@ import type { ReplyPayload } from "../../../src/auto-reply/types.js";
import { primeChannelOutboundSendMock } from "../../../src/channels/plugins/contracts/test-helpers.js";
import { createDirectTextMediaOutbound } from "../../../src/channels/plugins/outbound/direct-text-media.js";
import type { ChannelOutboundAdapter } from "../../../src/channels/plugins/types.js";
import { resetGlobalHookRunner } from "../../../src/plugins/hook-runner-global.js";
import { loadBundledPluginTestApiSync } from "../../../src/test-utils/bundled-plugin-public-surface.js";
type ParseZalouserOutboundTarget = (raw: string) => { threadId: string; isGroup: boolean };
@@ -71,6 +72,10 @@ function installChannelOutboundPayloadContractSuite(params: {
to: string;
};
}) {
beforeEach(() => {
resetGlobalHookRunner();
});
it("text-only delegates to sendText", async () => {
const { run, sendMock, to } = params.createHarness({
payload: { text: "hello" },