mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-06 23:08:03 +00:00
14e8e6f6b6
* get started * make it work again * make it compile again * Use async-wasm-feature of jsonrpsee from the master branch * Ensure we enable JS feature of getrandom for the wasm target * Update subxt/src/lib.rs * update jsonrpsee * fix CI * cargo fmt * fix wasm test * fix grumbles * exclude wasm-tests from workspace To avoid leaking `jsonrpsee-web` feature into the workspace Co-authored-by: Igor Matuszewski <xanewok@gmail.com>
27 lines
658 B
Rust
27 lines
658 B
Rust
#![cfg(target_arch = "wasm32")]
|
|
|
|
use subxt::config::PolkadotConfig;
|
|
use wasm_bindgen_test::*;
|
|
|
|
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
|
|
|
|
/// Run the tests by `$ wasm-pack test --firefox --headless`
|
|
|
|
fn init_tracing() {
|
|
console_error_panic_hook::set_once();
|
|
tracing_wasm::set_as_global_default();
|
|
}
|
|
|
|
#[wasm_bindgen_test]
|
|
async fn wasm_ws_transport_works() {
|
|
init_tracing();
|
|
|
|
let client =
|
|
subxt::client::OnlineClient::<PolkadotConfig>::from_url("ws://127.0.0.1:9944")
|
|
.await
|
|
.unwrap();
|
|
|
|
let chain = client.rpc().system_chain().await.unwrap();
|
|
assert_eq!(&chain, "Development");
|
|
}
|