collab_tests.rs

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