Skip to content

Commit 7133f6f

Browse files
committed
[bfops/wasm-test]: refactor
1 parent a7f81b4 commit 7133f6f

2 files changed

Lines changed: 5 additions & 10 deletions

File tree

  • sdks/rust/tests

sdks/rust/tests/connect_disconnect_client/src/main.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,9 @@ pub(crate) async fn dispatch() {
148148
}
149149

150150
async fn wait_for_all(test_counter: &std::sync::Arc<TestCounter>) {
151+
// wasm/web callbacks run on the JS event loop, so this wait must stay async.
151152
#[cfg(target_arch = "wasm32")]
152-
{
153-
// wasm/web callbacks run on the JS event loop, so this wait must stay async.
154-
test_counter.wait_for_all_async().await;
155-
return;
156-
}
153+
test_counter.wait_for_all_async().await;
157154

158155
#[cfg(not(target_arch = "wasm32"))]
159156
test_counter.wait_for_all();

sdks/rust/tests/test-counter/src/lib.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,10 @@ impl TestCounter {
6666
}
6767

6868
pub async fn wait_for_all_async(&self) {
69+
// wasm/web test clients run callbacks on a single-threaded event loop,
70+
// so waiting must be async to allow callback tasks to make progress.
6971
#[cfg(target_arch = "wasm32")]
70-
{
71-
// wasm/web test clients run callbacks on a single-threaded event loop,
72-
// so waiting must be async to allow callback tasks to make progress.
73-
self.wait_for_all_wasm_async().await;
74-
}
72+
self.wait_for_all_wasm_async().await;
7573

7674
#[cfg(not(target_arch = "wasm32"))]
7775
self.wait_for_all_native();

0 commit comments

Comments
 (0)