test(telegram): ensure newline split case exceeds max length

This commit is contained in:
chumyin 2026-02-16 19:36:39 +08:00
parent 2d6ec2fb71
commit dedb465377

View file

@ -919,7 +919,8 @@ mod tests {
#[test] #[test]
fn telegram_split_at_newline() { fn telegram_split_at_newline() {
let text_block = "Line of text\n".repeat(TELEGRAM_MAX_MESSAGE_LENGTH / 13); let line = "Line of text\n";
let text_block = line.repeat(TELEGRAM_MAX_MESSAGE_LENGTH / line.len() + 1);
let chunks = split_message_for_telegram(&text_block); let chunks = split_message_for_telegram(&text_block);
assert!(chunks.len() >= 2); assert!(chunks.len() >= 2);
for chunk in chunks { for chunk in chunks {