Browse Source

Fix flaky test.

wip
Titouan Rigoudy 4 years ago
parent
commit
0ce0f763f2
1 changed files with 19 additions and 7 deletions
  1. +19
    -7
      client/src/handlers/room_list_request_handler.rs

+ 19
- 7
client/src/handlers/room_list_request_handler.rs View File

@ -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)),
]
);
}
}

Loading…
Cancel
Save