From e0f74b485693aff06d6081fa3dc1da8d2fd9497e Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 27 Aug 2026 04:51:14 +0000 Subject: [PATCH 1/2] Add comprehensive tests for `is_assistant_topic` in `context.rs` Co-authored-by: undivisible <136312656+undivisible@users.noreply.github.com> --- src/context.rs | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/context.rs b/src/context.rs index 3f75374..607a101 100644 --- a/src/context.rs +++ b/src/context.rs @@ -137,4 +137,42 @@ mod tests { assert!(msg.contains("Transport: telegram")); assert!(msg.contains("Respond even without a direct mention")); } + + #[test] + fn test_is_assistant_topic_empty() { + assert!(!is_assistant_topic("")); + assert!(!is_assistant_topic(" ")); + assert!(!is_assistant_topic("\n\t")); + } + + #[test] + fn test_is_assistant_topic_matches_group_keywords() { + // exact matches + assert!(is_assistant_topic("apollo")); + assert!(is_assistant_topic("plugin")); + + // case insensitivity + assert!(is_assistant_topic("ApOlLo")); + assert!(is_assistant_topic(" PLUGIN LAYER ")); + + // substring matches + assert!(is_assistant_topic("tell me about plugins please")); + assert!(is_assistant_topic("how do i configure this")); + } + + #[test] + fn test_is_assistant_topic_matches_general_patterns() { + assert!(is_assistant_topic("what can you do?")); + assert!(is_assistant_topic("how does this work")); + assert!(is_assistant_topic("could you help me?")); + assert!(is_assistant_topic("we need to set up the environment")); + } + + #[test] + fn test_is_assistant_topic_no_match() { + assert!(!is_assistant_topic("hello there")); + assert!(!is_assistant_topic("I went to the store today")); + assert!(!is_assistant_topic("let's grab some coffee")); + assert!(!is_assistant_topic("random chat message")); + } } From be57c663f600630f633e214eda770cb90de7fc83 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 27 Aug 2026 05:35:18 +0000 Subject: [PATCH 2/2] Add comprehensive tests for `is_assistant_topic` in `context.rs` Co-authored-by: undivisible <136312656+undivisible@users.noreply.github.com>