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