diff --git a/src/discord/monitor.test.ts b/src/discord/monitor.test.ts index 21057369b..29d9690f4 100644 --- a/src/discord/monitor.test.ts +++ b/src/discord/monitor.test.ts @@ -727,7 +727,10 @@ describe("discord reaction notification gating", () => { expect( shouldEmitDiscordReactionNotification({ ...testCase.input, - allowlist: testCase.input.allowlist ? [...testCase.input.allowlist] : undefined, + allowlist: + "allowlist" in testCase.input && testCase.input.allowlist + ? [...testCase.input.allowlist] + : undefined, }), testCase.name, ).toBe(testCase.expected); diff --git a/src/infra/outbound/outbound.test.ts b/src/infra/outbound/outbound.test.ts index 56cff3ca2..7754f94e3 100644 --- a/src/infra/outbound/outbound.test.ts +++ b/src/infra/outbound/outbound.test.ts @@ -847,9 +847,13 @@ describe("normalizeOutboundPayloadsForJson", () => { ]; for (const testCase of cases) { - expect( - normalizeOutboundPayloadsForJson(testCase.input.map((payload) => ({ ...payload }))), - ).toEqual(testCase.expected); + const input = testCase.input.map((payload) => { + if ("mediaUrls" in payload && payload.mediaUrls) { + return { ...payload, mediaUrls: [...payload.mediaUrls] }; + } + return { ...payload }; + }); + expect(normalizeOutboundPayloadsForJson(input)).toEqual(testCase.expected); } }); }); diff --git a/src/telegram/send.test.ts b/src/telegram/send.test.ts index 2ef6df9a7..e1172d09c 100644 --- a/src/telegram/send.test.ts +++ b/src/telegram/send.test.ts @@ -595,16 +595,20 @@ describe("sendMessageTelegram", () => { fileName: "video.mp4", }); - const opts = { + const opts: Parameters[2] = { token: "tok", api, mediaUrl: "https://example.com/video.mp4", asVideoNote: true, - ...testCase.options, + ...("replyToMessageId" in testCase.options + ? { replyToMessageId: testCase.options.replyToMessageId } + : {}), + ...("buttons" in testCase.options + ? { + buttons: testCase.options.buttons.map((row) => row.map((button) => ({ ...button }))), + } + : {}), }; - if (opts.buttons) { - opts.buttons = opts.buttons.map((row) => [...row]); - } await sendMessageTelegram(chatId, testCase.text, opts);