1use std::sync::Arc;
2
3use call::Room;
4use client::ChannelId;
5use gpui::{Entity, TestAppContext};
6
7mod channel_buffer_tests;
8mod channel_guest_tests;
9mod channel_message_tests;
10mod channel_tests;
11// mod debug_panel_tests;
12mod editor_tests;
13mod following_tests;
14mod git_tests;
15mod integration_tests;
16mod notification_tests;
17mod random_channel_buffer_tests;
18mod random_project_collaboration_tests;
19mod randomized_test_helpers;
20mod remote_editing_collaboration_tests;
21mod stripe_billing_tests;
22mod test_server;
23
24use language::{Language, LanguageConfig, LanguageMatcher, tree_sitter_rust};
25pub use randomized_test_helpers::{
26 RandomizedTest, TestError, UserTestPlan, run_randomized_test, save_randomized_test_plan,
27};
28pub use test_server::{TestClient, TestServer};
29
30#[derive(Debug, Eq, PartialEq)]
31struct RoomParticipants {
32 remote: Vec<String>,
33 pending: Vec<String>,
34}
35
36fn room_participants(room: &Entity<Room>, cx: &mut TestAppContext) -> RoomParticipants {
37 room.read_with(cx, |room, _| {
38 let mut remote = room
39 .remote_participants()
40 .values()
41 .map(|participant| participant.user.github_login.clone().to_string())
42 .collect::<Vec<_>>();
43 let mut pending = room
44 .pending_participants()
45 .iter()
46 .map(|user| user.github_login.clone().to_string())
47 .collect::<Vec<_>>();
48 remote.sort();
49 pending.sort();
50 RoomParticipants { remote, pending }
51 })
52}
53
54fn channel_id(room: &Entity<Room>, cx: &mut TestAppContext) -> Option<ChannelId> {
55 cx.read(|cx| room.read(cx).channel_id())
56}
57
58fn rust_lang() -> Arc<Language> {
59 Arc::new(Language::new(
60 LanguageConfig {
61 name: "Rust".into(),
62 matcher: LanguageMatcher {
63 path_suffixes: vec!["rs".to_string()],
64 ..Default::default()
65 },
66 ..Default::default()
67 },
68 Some(tree_sitter_rust::LANGUAGE.into()),
69 ))
70}