tests.rs

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