fix: preserve whitespace in telegram html retry chunking

This commit is contained in:
Ayaan Zaidi
2026-02-28 08:06:06 +05:30
committed by Ayaan Zaidi
parent 69c39368ec
commit 2bef2910f1
2 changed files with 68 additions and 2 deletions

View File

@@ -166,6 +166,14 @@ describe("markdownToTelegramChunks - file reference wrapping", () => {
expect(chunks.map((chunk) => chunk.text).join("")).toBe(input);
expect(chunks.every((chunk) => chunk.html.length <= 512)).toBe(true);
});
it("preserves whitespace when html-limit retry splitting runs", () => {
const input = "a < b";
const chunks = markdownToTelegramChunks(input, 5);
expect(chunks.length).toBeGreaterThan(1);
expect(chunks.map((chunk) => chunk.text).join("")).toBe(input);
expect(chunks.every((chunk) => chunk.html.length <= 5)).toBe(true);
});
});
describe("edge cases", () => {