diff --git a/tests/codex/helpers/mockclock.nim b/tests/codex/helpers/mockclock.nim index ada449f9..75a251c9 100644 --- a/tests/codex/helpers/mockclock.nim +++ b/tests/codex/helpers/mockclock.nim @@ -40,3 +40,6 @@ method waitUntil*(clock: MockClock, time: SecondsSince1970) {.async.} = let future = newFuture[void]() clock.waiting.add(Waiting(until: time, future: future)) await future + +proc isWaiting*(clock: MockClock): bool = + clock.waiting.len > 0 diff --git a/tests/codex/sales/states/testinitialproving.nim b/tests/codex/sales/states/testinitialproving.nim index 69355567..af12852b 100644 --- a/tests/codex/sales/states/testinitialproving.nim +++ b/tests/codex/sales/states/testinitialproving.nim @@ -44,8 +44,6 @@ asyncchecksuite "sales state 'initialproving'": state = SaleInitialProving.new() proc allowProofToStart {.async.} = - # wait until we're in initialproving state - await sleepAsync(10.millis) # it won't start proving until the next period await clock.advanceToNextPeriod(market) @@ -59,7 +57,7 @@ asyncchecksuite "sales state 'initialproving'": test "waits for the beginning of the period to get the challenge": let future = state.run(agent) - await sleepAsync(10.millis) + check eventually clock.isWaiting check not future.finished await allowProofToStart() discard await future @@ -68,7 +66,7 @@ asyncchecksuite "sales state 'initialproving'": market.proofPointer = 250 let future = state.run(agent) await allowProofToStart() - await sleepAsync(10.millis) + check eventually clock.isWaiting check not future.finished market.proofPointer = 100 await allowProofToStart()