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