11use crate :: state:: { init_state, with_state, with_state_mut} ;
22use crate :: timer;
3- use crate :: tvl:: { self , exchange_rate_canister, governance, spawn , time} ;
3+ use crate :: tvl:: { self , exchange_rate_canister, governance, time} ;
44use candid:: Nat ;
55use lazy_static:: lazy_static;
66
@@ -398,13 +398,7 @@ async fn start_updating_exchange_rate_in_background() {
398398 timer. delay,
399399 std:: time:: Duration :: from_secs( expected_timer_delay_seconds)
400400 ) ;
401- // The timer calls spawn::spawn, which, during the test, adds the future
402- // to a queue.
403- ( timer. func ) ( ) ;
404- // Make sure the spawned future is run.
405- let mut spawned_futures = spawn:: testing:: drain_spawned_futures ( ) ;
406- assert_eq ! ( spawned_futures. len( ) , 1 ) ;
407- spawned_futures. pop ( ) . unwrap ( ) . await ;
401+ timer. future . await ;
408402 }
409403
410404 // Step 4: Verify the state after calling the 1-time timer.
@@ -442,13 +436,7 @@ async fn start_updating_exchange_rate_in_background() {
442436 timer. interval,
443437 std:: time:: Duration :: from_secs( expected_timer_interval_seconds)
444438 ) ;
445- // The timer calls spawn::spawn, which, during the test, adds the future
446- // to a queue.
447- ( timer. func ) ( ) ;
448- // Make sure the spawned future is run.
449- let mut spawned_futures = spawn:: testing:: drain_spawned_futures ( ) ;
450- assert_eq ! ( spawned_futures. len( ) , 1 ) ;
451- spawned_futures. pop ( ) . unwrap ( ) . await ;
439+ ( timer. func ) ( ) . await ;
452440 }
453441
454442 // Step 4: Verify the state after calling interval timer.
@@ -505,13 +493,7 @@ async fn start_updating_locked_icp_in_the_background() {
505493 timer. delay,
506494 std:: time:: Duration :: from_secs( expected_timer_delay_seconds)
507495 ) ;
508- // The timer calls spawn::spawn, which, during the test, adds the future
509- // to a queue.
510- ( timer. func ) ( ) ;
511- // Make sure the spawned future is run.
512- let mut spawned_futures = spawn:: testing:: drain_spawned_futures ( ) ;
513- assert_eq ! ( spawned_futures. len( ) , 1 ) ;
514- spawned_futures. pop ( ) . unwrap ( ) . await ;
496+ timer. future . await ;
515497 }
516498
517499 // Step 4: Verify the state after calling the 1-time timer.
@@ -534,13 +516,7 @@ async fn start_updating_locked_icp_in_the_background() {
534516 timer. interval,
535517 std:: time:: Duration :: from_secs( expected_timer_interval_seconds)
536518 ) ;
537- // The timer calls spawn::spawn, which, during the test, adds the future
538- // to a queue.
539- ( timer. func ) ( ) ;
540- // Make sure the spawned future is run.
541- let mut spawned_futures = spawn:: testing:: drain_spawned_futures ( ) ;
542- assert_eq ! ( spawned_futures. len( ) , 1 ) ;
543- spawned_futures. pop ( ) . unwrap ( ) . await ;
519+ ( timer. func ) ( ) . await ;
544520 }
545521
546522 // Step 4: Verify the state after calling interval timer.
0 commit comments