























@@ -1099,8 +1099,44 @@ describe("sendMessageTelegram", () => {
10991099expect(chunks.join("\n")).toBe(markdown);
11001100});
110111011102-it("does not split rich block chunks on blank lines inside fences", async () => {
1102+it("keeps long rich markdown lists intact", async () => {
11031103botApi.sendMessage.mockResolvedValue({ message_id: 55, chat: { id: "123" } });
1104+const markdown = Array.from({ length: 600 }, (_, index) => `- Item ${index + 1}`).join("\n");
1105+1106+await sendMessageTelegram("123", markdown, {
1107+cfg: TELEGRAM_TEST_CFG,
1108+token: "tok",
1109+});
1110+1111+expect(botRawApi.sendRichMessage).toHaveBeenCalledTimes(1);
1112+expect(botRawApi.sendRichMessage).toHaveBeenCalledWith({
1113+chat_id: "123",
1114+rich_message: { markdown },
1115+});
1116+});
1117+1118+it("keeps tall rich markdown tables intact", async () => {
1119+botApi.sendMessage.mockResolvedValue({ message_id: 56, chat: { id: "123" } });
1120+const markdown = [
1121+"| Name | Value |",
1122+"| --- | --- |",
1123+ ...Array.from({ length: 600 }, (_, index) => `| Row ${index + 1} | ${index + 1} |`),
1124+].join("\n");
1125+1126+await sendMessageTelegram("123", markdown, {
1127+cfg: TELEGRAM_TEST_CFG,
1128+token: "tok",
1129+});
1130+1131+expect(botRawApi.sendRichMessage).toHaveBeenCalledTimes(1);
1132+expect(botRawApi.sendRichMessage).toHaveBeenCalledWith({
1133+chat_id: "123",
1134+rich_message: { markdown },
1135+});
1136+});
1137+1138+it("does not split rich block chunks on blank lines inside fences", async () => {
1139+botApi.sendMessage.mockResolvedValue({ message_id: 57, chat: { id: "123" } });
11041140const markdown = `~~~txt\n${Array.from({ length: 900 }, (_, index) => `line ${index + 1}`).join(
11051141 "\n\n",
11061142 )}\n~~~`;
@@ -1118,7 +1154,7 @@ describe("sendMessageTelegram", () => {
11181154});
1119115511201156it("does not split rich heading chunks inside fences", async () => {
1121-botApi.sendMessage.mockResolvedValue({ message_id: 56, chat: { id: "123" } });
1157+botApi.sendMessage.mockResolvedValue({ message_id: 58, chat: { id: "123" } });
11221158const markdown = `~~~md\n${Array.from(
11231159 { length: 600 },
11241160 (_, index) => `# Literal heading ${index + 1}`,
@@ -1137,7 +1173,7 @@ describe("sendMessageTelegram", () => {
11371173});
1138117411391175it("chunks long rich markdown fences into bounded markdown chunks", async () => {
1140-botApi.sendMessage.mockResolvedValue({ message_id: 57, chat: { id: "123" } });
1176+botApi.sendMessage.mockResolvedValue({ message_id: 59, chat: { id: "123" } });
11411177const markdown = `~~~ts\n${"const value = 1;\n".repeat(5000)}~~~`;
1142117811431179await sendMessageTelegram("123", markdown, {
@@ -1156,7 +1192,7 @@ describe("sendMessageTelegram", () => {
11561192});
1157119311581194it("chunks explicit rich HTML above the Bot API rich message limit", async () => {
1159-botApi.sendMessage.mockResolvedValue({ message_id: 58, chat: { id: "123" } });
1195+botApi.sendMessage.mockResolvedValue({ message_id: 60, chat: { id: "123" } });
11601196const html = `<b>${"A".repeat(70_000)}</b>`;
1161119711621198await sendMessageTelegram("123", html, {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。