tests.rs

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