|
|
|
@ -50,6 +50,11 @@ mod tests { |
|
|
|
|
|
|
|
use super::RoomListRequestHandler;
|
|
|
|
|
|
|
|
// Cannot get the compiler to be satisfied when borrowing the name...
|
|
|
|
fn room_name(pair: &(String, Room)) -> String {
|
|
|
|
pair.0.clone()
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn run_forwards_request() {
|
|
|
|
let mut bundle = ContextBundle::default();
|
|
|
|
@ -81,14 +86,21 @@ mod tests { |
|
|
|
|
|
|
|
let response = bundle.control_response_rx.blocking_recv().unwrap();
|
|
|
|
|
|
|
|
assert_eq!(
|
|
|
|
response,
|
|
|
|
let mut rooms = match response {
|
|
|
|
control::Response::RoomListResponse(control::RoomListResponse {
|
|
|
|
rooms: vec![
|
|
|
|
("apple".to_string(), Room::new(Visibility::Public, 42)),
|
|
|
|
("potato".to_string(), Room::new(Visibility::Public, 123)),
|
|
|
|
]
|
|
|
|
})
|
|
|
|
rooms,
|
|
|
|
}) => rooms,
|
|
|
|
_ => panic!("Unexpected control response: {:?}", response),
|
|
|
|
};
|
|
|
|
|
|
|
|
rooms.sort_by_key(room_name);
|
|
|
|
|
|
|
|
assert_eq!(
|
|
|
|
rooms,
|
|
|
|
vec![
|
|
|
|
("apple".to_string(), Room::new(Visibility::Public, 42)),
|
|
|
|
("potato".to_string(), Room::new(Visibility::Public, 123)),
|
|
|
|
]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|