Skip to content

Commit

Permalink
fix(rears): add tolerance to a too strict test
Browse files Browse the repository at this point in the history
  • Loading branch information
tassiluca committed Feb 21, 2024
1 parent f0b94f7 commit 3e5a0e1
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ class PipelineTransformationsTest extends AnyFunSpec with Matchers {

it("return a new channel that emit an item if the given timespan has passed without emitting anything") {
val span = 2.seconds
val tolerance = 10.milliseconds
Async.blocking:
val debounced = infiniteProducer().debounce(span)
debounced.read()
val before = System.currentTimeMillis()
for _ <- 1 to 4 do
val before = System.currentTimeMillis()
debounced.read()
val now = System.currentTimeMillis()
now - before should be > span.toMillis
now - before should be > (span.toMillis - tolerance.toMillis)
}
}

Expand Down

0 comments on commit 3e5a0e1

Please sign in to comment.