tests.rs

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