From ce6ba36f4ef44c93667cf9f7fda11aa280d200be Mon Sep 17 00:00:00 2001 From: Chummy Date: Thu, 19 Feb 2026 20:40:08 +0800 Subject: [PATCH] test: account for ellipsis when compacting channel history --- src/channels/mod.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/channels/mod.rs b/src/channels/mod.rs index c6a58af..ba55956 100644 --- a/src/channels/mod.rs +++ b/src/channels/mod.rs @@ -2181,6 +2181,7 @@ mod tests { api_key: None, api_url: None, reliability: Arc::new(crate::config::ReliabilityConfig::default()), + multimodal: crate::config::MultimodalConfig::default(), provider_runtime_options: providers::ProviderRuntimeOptions::default(), workspace_dir: Arc::new(std::env::temp_dir()), message_timeout_secs: CHANNEL_MESSAGE_TIMEOUT_SECS, @@ -2196,9 +2197,12 @@ mod tests { .get(&sender) .expect("sender history should remain"); assert_eq!(kept.len(), CHANNEL_HISTORY_COMPACT_KEEP_MESSAGES); - assert!(kept - .iter() - .all(|turn| turn.content.chars().count() <= CHANNEL_HISTORY_COMPACT_CONTENT_CHARS)); + assert!(kept.iter().all(|turn| { + let len = turn.content.chars().count(); + len <= CHANNEL_HISTORY_COMPACT_CONTENT_CHARS + || (len <= CHANNEL_HISTORY_COMPACT_CONTENT_CHARS + 3 + && turn.content.ends_with("...")) + })); } struct DummyProvider;