mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-03-16 02:00:51 +00:00
futures: Add a test for creating multiple futures from the same promise
This commit is contained in:
parent
bf8a380264
commit
e20c4067dc
7
crates/futures/tests/tests.rs
Normal file → Executable file
7
crates/futures/tests/tests.rs
Normal file → Executable file
@ -108,3 +108,10 @@ fn spawn_local_err_no_exception() -> impl Future<Item = (), Error = JsValue> {
|
||||
})
|
||||
}
|
||||
|
||||
#[wasm_bindgen_test(async)]
|
||||
fn can_create_multiple_futures_from_same_promise() -> impl Future<Item = (), Error = JsValue> {
|
||||
let promise = js_sys::Promise::resolve(&JsValue::null());
|
||||
let a = JsFuture::from(promise.clone());
|
||||
let b = JsFuture::from(promise);
|
||||
futures::future::join_all(vec![a, b]).map(|_| ())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user