From 47c229311e817e599e9ed9080a2fea784cbbf878 Mon Sep 17 00:00:00 2001 From: benbierens Date: Thu, 21 Nov 2024 13:41:20 +0100 Subject: [PATCH] Adds isWaiting to mockClock to remove sleep in testsales --- tests/codex/helpers/mockclock.nim | 3 +++ tests/codex/sales/testsales.nim | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) 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/testsales.nim b/tests/codex/sales/testsales.nim index 3d142d16..b66d973f 100644 --- a/tests/codex/sales/testsales.nim +++ b/tests/codex/sales/testsales.nim @@ -190,7 +190,7 @@ asyncchecksuite "Sales": proc allowRequestToStart {.async.} = # wait until we're in initialproving state - await sleepAsync(10.millis) + check eventually clock.isWaiting # it won't start proving until the next period await clock.advanceToNextPeriod(market)