Skip to content

Commit

Permalink
Add test for cross-channel history
Browse files Browse the repository at this point in the history
  • Loading branch information
nuxeh committed Feb 1, 2020
1 parent 70d5a48 commit 50d9790
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ mod tests {
fn test_process_titles_repost() {
let mut rtd = Rtd::default();
rtd.conf.features.history = true;
rtd.conf.features.cross_channel_history = false;

let msg = Msg::new(&rtd, "testnick", "#test", "http://0.0.0.0:8084/");
let db = Database::open_in_memory().unwrap();
Expand Down Expand Up @@ -515,6 +516,29 @@ mod tests {
assert!(false);
}
});

rtd.conf.features.mask_highlights = false;

// no cross-posted history results if not enabled in configuration
let msg2 = Msg::new(&rtd, "testnick", "#test2", "http://0.0.0.0:8084/");

process_titles(&rtd, &db, &msg2)
.for_each(|v| assert_eq!(TITLE("⤷ |t|".to_string()), v));

rtd.conf.features.cross_channel_history = true;

process_titles(&rtd, &db, &msg2)
.for_each(|v| {
println!("{:?}", v);
if let TITLE(s) = v {
assert!(s.starts_with("⤷ |t| → "));
assert!(date.is_match(&s));
assert!(s.ends_with(" testnick (#test)"));
} else {
assert!(false);
}
});

}

#[test]
Expand Down

0 comments on commit 50d9790

Please sign in to comment.