tests.rs

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