From e386c9bb3c4ad38b313bce8ec239da3e888ec5a7 Mon Sep 17 00:00:00 2001 From: joshavant <830519+joshavant@users.noreply.github.com> Date: Fri, 13 Mar 2026 21:18:00 -0500 Subject: [PATCH] test: annotate outbound helper return type for ts portability --- src/infra/outbound/deliver.test-helpers.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/infra/outbound/deliver.test-helpers.ts b/src/infra/outbound/deliver.test-helpers.ts index a386808b75e..6eb1ba5f87a 100644 --- a/src/infra/outbound/deliver.test-helpers.ts +++ b/src/infra/outbound/deliver.test-helpers.ts @@ -191,7 +191,10 @@ export function resetDeliverTestMocks(params?: { includeSessionMocks?: boolean } export async function runChunkedWhatsAppDelivery(params: { deliverOutboundPayloads: DeliverOutboundPayloadsFn; mirror?: Parameters[0]["mirror"]; -}) { +}): Promise<{ + sendWhatsApp: (...args: unknown[]) => unknown; + results: Array<{ messageId?: string; toJid?: string }>; +}> { const sendWhatsApp = vi .fn() .mockResolvedValueOnce({ messageId: "w1", toJid: "jid" }) @@ -207,5 +210,14 @@ export async function runChunkedWhatsAppDelivery(params: { deps: { sendWhatsApp }, ...(params.mirror ? { mirror: params.mirror } : {}), }); - return { sendWhatsApp, results }; + return { + sendWhatsApp, + results: results.map((result) => ({ + messageId: + typeof result.messageId === "string" && result.messageId.length > 0 + ? result.messageId + : undefined, + toJid: typeof result.toJid === "string" && result.toJid.length > 0 ? result.toJid : undefined, + })), + }; }