Skip to content

Commit

Permalink
Update zio, zio-streams to 2.0.19 (#357)
Browse files Browse the repository at this point in the history
* Update zio, zio-streams to 2.0.19

* test

* test

---------

Co-authored-by: johannes karoff <johannes@karoff.net>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 12, 2023
1 parent 1caa2e5 commit fe2912e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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",
),
)

Expand Down
30 changes: 27 additions & 3 deletions zio/src/test/scala/colibri/ObservableSpec.scala
Original file line number Diff line number Diff line change
@@ -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]
Expand Down Expand Up @@ -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()
}
}

0 comments on commit fe2912e

Please sign in to comment.