

























@@ -361,7 +361,9 @@ describe("deliverReplies", () => {
361361 bot,
362362});
363363364-expect(mockCallArg(messageHookRunner.runMessageSending, 0, 0)).toBeDefined();
364+if (mockCallArg(messageHookRunner.runMessageSending, 0, 0) === undefined) {
365+throw new Error("Expected message_sending hook payload");
366+}
365367expectRecordFields(mockCallArg(messageHookRunner.runMessageSending, 0, 1), {
366368channelId: "telegram",
367369accountId: "work",
@@ -630,7 +632,9 @@ describe("deliverReplies", () => {
630632});
631633632634expect(sendPhoto.mock.calls[0]?.[0]).toBe("123");
633-expect(sendPhoto.mock.calls[0]?.[1]).toBeDefined();
635+if (sendPhoto.mock.calls[0]?.[1] === undefined) {
636+throw new Error("Expected Telegram photo media");
637+}
634638expectRecordFields(mockCallArg(sendPhoto, 0, 2), {
635639caption: "hi <b>boss</b>",
636640parse_mode: "HTML",
@@ -656,7 +660,9 @@ describe("deliverReplies", () => {
656660657661expect(probeVideoDimensions).toHaveBeenCalledWith(Buffer.from("video"));
658662expect(sendVideo.mock.calls[0]?.[0]).toBe("123");
659-expect(sendVideo.mock.calls[0]?.[1]).toBeDefined();
663+if (sendVideo.mock.calls[0]?.[1] === undefined) {
664+throw new Error("Expected Telegram video media");
665+}
660666expectRecordFields(mockCallArg(sendVideo, 0, 2), {
661667caption: "hi <b>boss</b>",
662668parse_mode: "HTML",
@@ -683,7 +689,9 @@ describe("deliverReplies", () => {
683689684690expect(probeVideoDimensions).not.toHaveBeenCalled();
685691expect(sendAnimation.mock.calls[0]?.[0]).toBe("123");
686-expect(sendAnimation.mock.calls[0]?.[1]).toBeDefined();
692+if (sendAnimation.mock.calls[0]?.[1] === undefined) {
693+throw new Error("Expected Telegram animation media");
694+}
687695const options = mockCallArg(sendAnimation, 0, 2) as Record<string, unknown>;
688696expect(typeof options.width).not.toBe("number");
689697expect(typeof options.height).not.toBe("number");
@@ -1124,7 +1132,9 @@ describe("deliverReplies", () => {
11241132expect(sendMessage).toHaveBeenCalledTimes(1);
11251133expect(sendMessage.mock.calls[0]?.[0]).toBe("123");
11261134expect(sendMessage.mock.calls[0]?.[1]).toContain("Hello there");
1127-expect(sendMessage.mock.calls[0]?.[2]).toBeDefined();
1135+if (sendMessage.mock.calls[0]?.[2] === undefined) {
1136+throw new Error("Expected Telegram fallback text options");
1137+}
11281138});
1129113911301140it("keeps disable_notification on voice fallback text when silent is true", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。