Testing
Use etl4s with the testing framework of your choice
Run nodes like normal functions
You will get:
Run pipelines with unsafeRun:
import etl4s._
val plus2: Transform[Int, Int] = Transform(_ + 2)
val times5: Transform[Int, Int] = Transform(_ * 5)
val p: Node[Int, Int] = plus2 ~> times5
p.unsafeRun(2)
Try:
You will get:
Or run through an effect with .compile[F] - .compile[Try] folds the outcome
into a Try for you, which is convenient in assertions:
import etl4s._
import scala.util.Success
val plus2: Transform[Int, Int] = Transform(_ + 2)
val times5: Transform[Int, Int] = Transform(_ * 5)
val p: Node[Int, Int] = plus2 ~> times5
p.compile[Try].unsafeRun(2)
See Effect polymorphism for the other effects.
Testing config pipelines
For nodes that .requires config, supply it with .provide(cfg) (or its alias
.provideContext) before running - swap in test config at the edge:
etl4s