Start sketching out an integration test for calls

Antonio Scandurra and Nathan Sobo created

Co-Authored-By: Nathan Sobo <nathan@zed.dev>

Change summary

Cargo.lock                             |  1 +
crates/collab/Cargo.toml               |  3 ++-
crates/collab/src/integration_tests.rs | 12 +++++++-----
crates/room/src/room.rs                |  4 ++--
4 files changed, 12 insertions(+), 8 deletions(-)

Detailed changes

Cargo.lock 🔗

@@ -1040,6 +1040,7 @@ dependencies = [
  "prometheus",
  "rand 0.8.5",
  "reqwest",
+ "room",
  "rpc",
  "scrypt",
  "serde",

crates/collab/Cargo.toml 🔗

@@ -55,13 +55,14 @@ features = ["runtime-tokio-rustls", "postgres", "time", "uuid"]
 [dev-dependencies]
 collections = { path = "../collections", features = ["test-support"] }
 gpui = { path = "../gpui", features = ["test-support"] }
-rpc = { path = "../rpc", features = ["test-support"] }
 client = { path = "../client", features = ["test-support"] }
 editor = { path = "../editor", features = ["test-support"] }
 language = { path = "../language", features = ["test-support"] }
 log = { version = "0.4.16", features = ["kv_unstable_serde"] }
 lsp = { path = "../lsp", features = ["test-support"] }
 project = { path = "../project", features = ["test-support"] }
+room = { path = "../room", features = ["test-support"] }
+rpc = { path = "../rpc", features = ["test-support"] }
 settings = { path = "../settings", features = ["test-support"] }
 theme = { path = "../theme" }
 workspace = { path = "../workspace", features = ["test-support"] }

crates/collab/src/integration_tests.rs 🔗

@@ -90,10 +90,15 @@ async fn test_share_project_in_room(
         )
         .await;
 
+    let room_a = Room::create(client_a.clone()).await.unwrap();
     let (project_a, worktree_id) = client_a.build_local_project("/a", cx_a).await;
-    let project_id = project_a.update(cx_a, |project, cx| project.share(cx)).await.unwrap();
-
+    // room.publish_project(project_a.clone()).await.unwrap();
 
+    let incoming_calls_b = client_b.user_store.incoming_calls();
+    let user_b_joined = room_a.invite(client_b.user_id().unwrap());
+    let call_b = incoming_calls_b.next().await.unwrap();
+    let room_b = Room::join(call_b.room_id, client_b.clone()).await.unwrap();
+    user_b_joined.await.unwrap();
 }
 
 #[gpui::test(iterations = 10)]
@@ -5469,9 +5474,6 @@ impl TestClient {
         worktree
             .read_with(cx, |tree, _| tree.as_local().unwrap().scan_complete())
             .await;
-        project
-            .update(cx, |project, _| project.next_remote_id())
-            .await;
         (project, worktree.read_with(cx, |tree, _| tree.id()))
     }
 

crates/room/src/room.rs 🔗

@@ -35,11 +35,11 @@ impl Room {
         todo!()
     }
 
-    pub async fn share_project(&mut self, project: ModelHandle<Project>) -> Result<()> {
+    pub async fn publish_project(&mut self, project: ModelHandle<Project>) -> Result<()> {
         todo!()
     }
 
-    pub async fn unshare_project(&mut self, project: ModelHandle<Project>) -> Result<()> {
+    pub async fn unpublish_project(&mut self, project: ModelHandle<Project>) -> Result<()> {
         todo!()
     }