Testing
Use etl4s with whatever test framework you like.
Run a node or pipeline
Nodes are just functions, so you can call them directly:
You will get:
Run a pipeline 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)
Check for failures
To catch failures, wrap the run in a Try:
Or compile to Try, which is handy 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.
Test pipelines that need config
Just .provide test config before running:
etl4s