Test.Runner.Effectful
Functions for running Gren integration tests that depend on the actual results of tasks.
run :
Array (Task Never Test) -> Program
Create the program that runs your tests.
It takes an array of values defined with await
and returns a program that can be run as your main
function.
await :
Task error a -> String -> (a -> Test) -> Task Never Test
Await the results of a task and run tests that depend on the result.
await Time.now "The current time" <| \now ->
test "is not January 1, 1970" \_ ->
Expect.notEqual (Time.millisToPosix 0) now
expectError :
Task error a
-> String
-> (error -> Test)
-> Task Never Test
Await task that you expect to fail and run tests that depend on the error value.
expectError (Task.fail "oopsy") "An expected failure" <| \error ->
test "is an oopsy" \_ ->
Expect.equal "oopsy" error