diff --git a/tests/tests/readable_stream.rs b/tests/tests/readable_stream.rs index c353178..30311b2 100644 --- a/tests/tests/readable_stream.rs +++ b/tests/tests/readable_stream.rs @@ -298,3 +298,17 @@ async fn test_readable_stream_into_stream_then_into_async_read() { assert_eq!(async_read.read(&mut buf).await.unwrap(), 0); assert_eq!(&buf, &[4, 5, 6]); } + +#[wasm_bindgen_test] +async fn test_readable_stream_from_js_array() { + let js_array = + js_sys::Array::from_iter([JsValue::from_str("Hello"), JsValue::from_str("world!")]); + let mut readable = ReadableStream::from(js_array.unchecked_into()); + assert!(!readable.is_locked()); + + let mut reader = readable.get_reader(); + assert_eq!(reader.read().await.unwrap(), Some(JsValue::from("Hello"))); + assert_eq!(reader.read().await.unwrap(), Some(JsValue::from("world!"))); + assert_eq!(reader.read().await.unwrap(), None); + reader.closed().await.unwrap(); +}