diff --git a/rears-core/src/test/scala/io/github/tassiLuca/rears/PipelineTransformationsTest.scala b/rears-core/src/test/scala/io/github/tassiLuca/rears/PipelineTransformationsTest.scala index 8a75de3c..969c23a2 100644 --- a/rears-core/src/test/scala/io/github/tassiLuca/rears/PipelineTransformationsTest.scala +++ b/rears-core/src/test/scala/io/github/tassiLuca/rears/PipelineTransformationsTest.scala @@ -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) } }