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