What to Expect When You’re Expecting
Now that you’re familiar with elm-test, let’s explore its API further. So far, you’ve used the simple Expect.equal expectation. The Expect module has other expectations such as Expect.notEqual, Expect.lessThan, and Expect.greaterThan when a simple Expect.equal doesn’t cut it. As you might imagine, an expectation such as Expect.greaterThan would expect the second argument (value to the left of the pipe operator) to be greater than the first argument. Look at this example to see what I mean.
| describe "greaterThan" |
| [ test "expects second argument to be greater than first" <| |
| \_ -> 42 |> Expect.greaterThan 41 |
| ] |
You can see more examples on the Expect module’s documentation page.[32]
In this ...
Get Programming Elm now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.