tests.rs

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