Adds isWaiting to mockClock to remove sleep in testsales

This commit is contained in:
benbierens 2024-11-21 13:41:20 +01:00
parent 9b7f3f4aaf
commit 47c229311e
No known key found for this signature in database
GPG Key ID: 877D2C2E09A22F3A
2 changed files with 4 additions and 1 deletions

View File

@ -40,3 +40,6 @@ method waitUntil*(clock: MockClock, time: SecondsSince1970) {.async.} =
let future = newFuture[void]() let future = newFuture[void]()
clock.waiting.add(Waiting(until: time, future: future)) clock.waiting.add(Waiting(until: time, future: future))
await future await future
proc isWaiting*(clock: MockClock): bool =
clock.waiting.len > 0

View File

@ -190,7 +190,7 @@ asyncchecksuite "Sales":
proc allowRequestToStart {.async.} = proc allowRequestToStart {.async.} =
# wait until we're in initialproving state # wait until we're in initialproving state
await sleepAsync(10.millis) check eventually clock.isWaiting
# it won't start proving until the next period # it won't start proving until the next period
await clock.advanceToNextPeriod(market) await clock.advanceToNextPeriod(market)