I’m using the same. Except that instead of \_ -> I have \() ->. I like to be explicit about parameters.
(Then if I turn the unit test into a fuzzer test then I get a compiler error to remind me to use the fuzz value)
I don’t think you’ll be able to reduce the indentation, but formatting-wise I do ↓
simple : Test
simple =
Test.describe "leap year"
[ test "no"
(\() ->
2001
|> isLeapYear
|> Expect.equal False
)
, test "yes"
(\() ->
2000
|> isLeapYear
|> Expect.equal True
)
]
() gives you the guarantee that no values will arrive there, which is helpful to remind you if you for example change to Test.fuzz. (as jfmengels wrote)
<| → paren application, op data |> expect → data |> op |> expect for reasons of simplicity, consistency:
Pipe data before the function: food |> op ...
Feed arguments after the function: ... |> opWith (a ...) (b ...)
Test.describe just to remove names exposed with implied context. Maybe describe is something a test tests or uses as a variable name in the future?