use crate::test_support::window::seated;
use crate::ui::{Aim, Model};
#[test]
fn the_aim_is_a_channel_and_an_address_together() {
let model = Model {
aim: Some(Aim {
channel: "one".to_owned(),
address: "home".to_owned(),
}),
..seated()
};
assert!(model.aimed_at("one", Some(&"home".to_owned())));
assert!(!model.aimed_at("two", Some(&"home".to_owned())));
assert!(!model.aimed_at("one", Some(&"other".to_owned())));
assert!(
!model.aimed_at("one", None),
"an unreachable row is never aimed at"
);
assert!(!Model::default().aimed_at("one", Some(&"home".to_owned())));
}
#[test]
fn a_channel_is_held_only_while_the_roster_carries_it() {
let model = seated();
let held = model.roster[0].channel.name.clone();
assert!(model.holds(&held));
assert!(!model.holds("a channel this box never had"));
}