From 0e810a2ec4cd3cee813d3046c946ff11660996da Mon Sep 17 00:00:00 2001 From: I Putu Eddy Irawan Date: Tue, 3 Mar 2026 09:20:16 +0700 Subject: [PATCH] fix: tighten HTML-expansion test to stay under chunk size Reduce markdown input from 700 to 600 repeats (3600 runes) so it stays under the 4000-rune chunk threshold. This ensures the test actually exercises the HTML-expansion re-splitting logic rather than being split at the markdown level first. Co-Authored-By: Claude Opus 4.6 --- pkg/channels/telegram/telegram_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/channels/telegram/telegram_test.go b/pkg/channels/telegram/telegram_test.go index ebbc36095..c75ba1957 100644 --- a/pkg/channels/telegram/telegram_test.go +++ b/pkg/channels/telegram/telegram_test.go @@ -207,11 +207,11 @@ func TestSend_MarkdownShortButHTMLLong_MultipleCalls(t *testing.T) { } ch := newTestChannel(t, caller) - // Create markdown whose length is <= 4096 but whose HTML expansion is much longer. - // "**a**" (5 chars) becomes "a" (8 chars) in HTML, so repeating it many times + // Create markdown whose length is <= 4000 but whose HTML expansion is much longer. + // "**a** " (6 chars) becomes "a " (9 chars) in HTML, so repeating it many times // yields HTML that exceeds Telegram's limit while markdown stays within it. - markdownContent := strings.Repeat("**a** ", 700) // ~4200 chars markdown, but HTML ~5600+ chars - assert.LessOrEqual(t, len([]rune(markdownContent)), 4200, "markdown content should be near Telegram limit") + markdownContent := strings.Repeat("**a** ", 600) // 3600 chars markdown, HTML ~5400+ chars + assert.LessOrEqual(t, len([]rune(markdownContent)), 4000, "markdown content must not exceed chunk size") htmlExpanded := markdownToTelegramHTML(markdownContent) assert.Greater(