futures: Add a test for creating multiple futures from the same promise

This commit is contained in:
Nick Fitzgerald 2019-02-04 16:38:21 +01:00
parent bf8a380264
commit e20c4067dc

7
crates/futures/tests/tests.rs Normal file → Executable file
View 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(|_| ())
}