Start sketching out an integration test for calls

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2022-09-22 19:41:51 +02:00
parent 8fec7da799
commit 0b1e372d11
4 changed files with 12 additions and 8 deletions

1
Cargo.lock generated
View file

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

View file

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

View file

@ -90,10 +90,15 @@ async fn test_share_project_in_room(
) )
.await; .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_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)] #[gpui::test(iterations = 10)]
@ -5469,9 +5474,6 @@ impl TestClient {
worktree worktree
.read_with(cx, |tree, _| tree.as_local().unwrap().scan_complete()) .read_with(cx, |tree, _| tree.as_local().unwrap().scan_complete())
.await; .await;
project
.update(cx, |project, _| project.next_remote_id())
.await;
(project, worktree.read_with(cx, |tree, _| tree.id())) (project, worktree.read_with(cx, |tree, _| tree.id()))
} }

View file

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