From fe2912e1bbf6c2cdf42e2a1ab182e3cf01f541c6 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Sun, 12 Nov 2023 20:11:19 +0100 Subject: [PATCH] Update zio, zio-streams to 2.0.19 (#357) * Update zio, zio-streams to 2.0.19 * test * test --------- Co-authored-by: johannes karoff Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- build.sbt | 4 +-- .../test/scala/colibri/ObservableSpec.scala | 30 +++++++++++++++++-- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/build.sbt b/build.sbt index ece43e07..db852a11 100644 --- a/build.sbt +++ b/build.sbt @@ -137,8 +137,8 @@ lazy val zio = project name := "colibri-zio", libraryDependencies ++= Seq( "io.github.cquiroz" %%% "scala-java-time" % "2.5.0", - "dev.zio" %%% "zio" % "2.0.6", - "dev.zio" %%% "zio-streams" % "2.0.6", + "dev.zio" %%% "zio" % "2.0.19", + "dev.zio" %%% "zio-streams" % "2.0.19", ), ) diff --git a/zio/src/test/scala/colibri/ObservableSpec.scala b/zio/src/test/scala/colibri/ObservableSpec.scala index 6c9c230b..b5155c81 100644 --- a/zio/src/test/scala/colibri/ObservableSpec.scala +++ b/zio/src/test/scala/colibri/ObservableSpec.scala @@ -1,12 +1,23 @@ package colibri +import cats.effect.IO +import cats.effect.unsafe import zio._ -// import zio.stream.ZStream import colibri.ext.zio._ import org.scalatest.matchers.should.Matchers import org.scalatest.flatspec.AsyncFlatSpec +import java.util.concurrent.TimeUnit + class ObservableSpec extends AsyncFlatSpec with Matchers { + override val executionContext = scala.scalajs.concurrent.QueueExecutionContext() + implicit val ioRuntime: unsafe.IORuntime = unsafe.IORuntime( + compute = this.executionContext, + blocking = this.executionContext, + config = unsafe.IORuntimeConfig(), + scheduler = unsafe.IORuntime.defaultScheduler, + shutdown = () => (), + ) "Observable" should "recover after mapEffect" in { var recovered = List.empty[Throwable] @@ -76,8 +87,21 @@ class ObservableSpec extends AsyncFlatSpec with Matchers { ), ) - received shouldBe List(15, 10, 6, 3, 1, 0) + cancelable.isEmpty() shouldBe false + received shouldBe List.empty errors shouldBe 0 - cancelable.isEmpty() shouldBe true + + import scala.concurrent.duration._ + + val test = for { + //TODO: why does it need an actual delay? + _ <- IO.sleep(FiniteDuration.apply(1, TimeUnit.SECONDS)) + + _ = received shouldBe List(15, 10, 6, 3, 1, 0) + _ = errors shouldBe 0 + _ = cancelable.isEmpty() shouldBe true + } yield succeed + + test.unsafeToFuture() } }