O'Reilly logo

Programming Elm by Jeremy Fairbank

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required