use crate::channels::telegram::handler::mentions_other_bot;
#[test]
fn tags_a_different_bot() {
assert!(mentions_other_bot(
"Verified. @otherservice_admin_bot can you update the issue?",
Some("ourbot"),
));
}
#[test]
fn only_our_bot_tagged_is_not_another_bot() {
assert!(!mentions_other_bot(
"hey @ourbot please update",
Some("ourbot")
));
assert!(!mentions_other_bot("hey @ourbot", Some("@ourbot")));
}
#[test]
fn both_us_and_another_bot_still_flags_the_other() {
assert!(mentions_other_bot("@ourbot and @otherbot", Some("ourbot")));
}
#[test]
fn human_mentions_do_not_count() {
assert!(!mentions_other_bot(
"@ourbot ask @john about it",
Some("ourbot")
));
assert!(!mentions_other_bot("thanks @alice_dev", Some("ourbot")));
}
#[test]
fn case_insensitive_and_underscored() {
assert!(mentions_other_bot(
"ping @Some_Admin_Tools_Bot",
Some("ourbot")
));
assert!(mentions_other_bot("ping @OTHERBOT", Some("ourbot")));
}
#[test]
fn no_mentions_or_unknown_self() {
assert!(!mentions_other_bot("no tags here at all", Some("ourbot")));
assert!(!mentions_other_bot("plain text", None));
assert!(!mentions_other_bot("@bot", Some("ourbot")));
}