tests.rs

 1use call::Room;
 2use gpui::{ModelHandle, TestAppContext};
 3
 4mod channel_buffer_tests;
 5mod channel_message_tests;
 6mod channel_tests;
 7mod integration_tests;
 8mod random_channel_buffer_tests;
 9mod random_project_collaboration_tests;
10mod randomized_test_helpers;
11mod test_server;
12
13pub use randomized_test_helpers::{
14    run_randomized_test, save_randomized_test_plan, RandomizedTest, TestError, UserTestPlan,
15};
16pub use test_server::{TestClient, TestServer};
17
18#[derive(Debug, Eq, PartialEq)]
19struct RoomParticipants {
20    remote: Vec<String>,
21    pending: Vec<String>,
22}
23
24fn room_participants(room: &ModelHandle<Room>, cx: &mut TestAppContext) -> RoomParticipants {
25    room.read_with(cx, |room, _| {
26        let mut remote = room
27            .remote_participants()
28            .iter()
29            .map(|(_, participant)| participant.user.github_login.clone())
30            .collect::<Vec<_>>();
31        let mut pending = room
32            .pending_participants()
33            .iter()
34            .map(|user| user.github_login.clone())
35            .collect::<Vec<_>>();
36        remote.sort();
37        pending.sort();
38        RoomParticipants { remote, pending }
39    })
40}