refactor(test): dedupe web broadcast group inbound setup

This commit is contained in:
Peter Steinberger
2026-02-14 21:10:53 +00:00
parent 3c043f5d2d
commit 0b59c48087
3 changed files with 45 additions and 42 deletions

View File

@@ -180,3 +180,29 @@ export async function sendWebGroupInboundMessage(params: {
sendMedia: params.spies.sendMedia,
} as WebInboundMessage);
}
export async function sendWebDirectInboundMessage(params: {
onMessage: (msg: WebInboundMessage) => Promise<void>;
body: string;
id: string;
from: string;
to: string;
spies: ReturnType<typeof createWebInboundDeliverySpies>;
accountId?: string;
}) {
const accountId = params.accountId ?? "default";
await params.onMessage({
accountId,
id: params.id,
from: params.from,
conversationId: params.from,
to: params.to,
body: params.body,
timestamp: Date.now(),
chatType: "direct",
chatId: `direct:${params.from}`,
sendComposing: params.spies.sendComposing,
reply: params.spies.reply,
sendMedia: params.spies.sendMedia,
} as WebInboundMessage);
}