Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

andriimartynov/scalatest-zio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZioFlatSpec for ScalaTest

Download Build Status Apache License V.2

ScalaTest spec for testing zio monad.

Getting ZioFlatSpec

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"

Usage example

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
  }
}