ScalaTest spec for testing zio monad.
To resolve artifacts through Artifactory, simply add the following code snippet to your build.sbt file:
resolvers += Resolver.jcenterRepo
The current version is 3.2.1, which is cross-built against Scala 2.11.x, 2.12.x and 2.13.x.
libraryDependencies += "org.github.andriimartynov" %% "scalatest-zio" % "3.2.1"
class ExampleSpec extends ZioFlatSpec {
//For RIO[SomeService, Assertion]
implicit protected val layer: Layer[Nothing, SomeService with AnowerService] = ...
//For IO[ExceptionWrapper, Assertion]
implicit protected val exceptionConverter: ExceptionWrapper => Throwable = ...
it should "a RIO example" in {
for {
result <- SomeService.method()
} yield result
}
it should "a IO example" in {
for {
result <- IO.fromFunction(_ => ...)
} yield result
}
it should "a Task example" in {
for {
result <- Task.fromFunction(_ => ...)
} yield result
}
}