summaryrefslogtreecommitdiff
path: root/cli/tests/integration/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/integration/mod.rs')
-rw-r--r--cli/tests/integration/mod.rs33
1 files changed, 33 insertions, 0 deletions
diff --git a/cli/tests/integration/mod.rs b/cli/tests/integration/mod.rs
index 150683749..3c067c17f 100644
--- a/cli/tests/integration/mod.rs
+++ b/cli/tests/integration/mod.rs
@@ -735,6 +735,39 @@ fn websocket_server_multi_field_connection_header() {
assert!(child.wait().unwrap().success());
}
+#[test]
+fn websocket_server_idletimeout() {
+ let script = util::testdata_path().join("websocket_server_idletimeout.ts");
+ let root_ca = util::testdata_path().join("tls/RootCA.pem");
+ let mut child = util::deno_cmd()
+ .arg("test")
+ .arg("--unstable")
+ .arg("--allow-net")
+ .arg("--cert")
+ .arg(root_ca)
+ .arg(script)
+ .stdout(std::process::Stdio::piped())
+ .spawn()
+ .unwrap();
+
+ let stdout = child.stdout.as_mut().unwrap();
+ let mut buffer = [0; 5];
+ let read = stdout.read(&mut buffer).unwrap();
+ assert_eq!(read, 5);
+ let msg = std::str::from_utf8(&buffer).unwrap();
+ assert_eq!(msg, "READY");
+
+ let req = http::request::Builder::new()
+ .uri("ws://localhost:4502")
+ .body(())
+ .unwrap();
+ let (_ws, _request) =
+ deno_runtime::deno_websocket::tokio_tungstenite::tungstenite::connect(req)
+ .unwrap();
+
+ assert!(child.wait().unwrap().success());
+}
+
#[cfg(not(windows))]
#[test]
fn set_raw_should_not_panic_on_no_tty() {