use crate::channels::telegram::delivery::{
is_react_only, is_react_only_turn, strip_echoed_plan_title,
};
#[test]
fn react_only_is_decided_by_emptiness_of_the_remaining_text() {
assert!(is_react_only(""));
assert!(is_react_only(" \n\t "));
assert!(!is_react_only("Done, fixed!"));
assert!(!is_react_only(" some text "));
}
#[test]
fn a_dedup_suppressed_final_is_not_react_only() {
assert!(
!is_react_only_turn(true, ""),
"a suppressed final must never be classified react-only"
);
assert!(
!is_react_only_turn(true, " \n "),
"whitespace-only is the same case once suppressed"
);
}
#[test]
fn a_genuine_react_only_turn_still_classifies() {
assert!(
is_react_only_turn(false, ""),
"empty text that was not suppressed is the real react-only turn"
);
assert!(is_react_only_turn(false, " \t "));
}
#[test]
fn text_bearing_turns_are_never_react_only_either_way() {
assert!(!is_react_only_turn(false, "Done, fixed!"));
assert!(!is_react_only_turn(true, "Done, fixed!"));
}
#[test]
fn echoed_plan_title_is_stripped_from_the_body() {
assert_eq!(
strip_echoed_plan_title("📋 Plan: \"Fix Bug\"\n\nHere is the fix", "Fix Bug"),
"Here is the fix"
);
assert_eq!(
strip_echoed_plan_title("No heading\nJust text", "Fix Bug"),
"No heading\nJust text"
);
}