tests.rs

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