diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2024-10-09 09:04:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-09 10:04:15 +0200 |
commit | 0dfd333649acd85508e62bb60e3be4946e543597 (patch) | |
tree | 533e7b3f497088b4e78ef3bc418918e8902014fe /tests/integration | |
parent | a62c7e036ab6851c0293f407ead635a7331445b7 (diff) |
fix(jupyter): keep running event loop when waiting for messages (#26049)
Closes https://github.com/denoland/deno/issues/24421
Diffstat (limited to 'tests/integration')
-rw-r--r-- | tests/integration/jupyter_tests.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/integration/jupyter_tests.rs b/tests/integration/jupyter_tests.rs index 1b2c21311..e99780a27 100644 --- a/tests/integration/jupyter_tests.rs +++ b/tests/integration/jupyter_tests.rs @@ -628,3 +628,37 @@ async fn jupyter_store_history_false() -> Result<()> { Ok(()) } + +#[tokio::test] +async fn jupyter_http_server() -> Result<()> { + let (_ctx, client, _process) = setup().await; + client + .send( + Shell, + "execute_request", + json!({ + "silent": false, + "store_history": false, + "code": r#"Deno.serve({ port: 10234 }, (req) => Response.json({ hello: "world" }))"#, + }), + ) + .await?; + + let reply = client.recv(Shell).await?; + assert_eq!(reply.header.msg_type, "execute_reply"); + assert_json_subset( + reply.content, + json!({ + "status": "ok", + "execution_count": 0, + }), + ); + + for _ in 0..3 { + let resp = reqwest::get("http://localhost:10234").await.unwrap(); + let text: serde_json::Value = resp.json().await.unwrap(); + assert_eq!(text, json!({ "hello": "world" })); + } + + Ok(()) +} |