elm-explorations / test

Write unit and fuzz tests for Elm code.
https://package.elm-lang.org/packages/elm-explorations/test/latest
BSD 3-Clause "New" or "Revised" License
236 stars 40 forks source link

Expect.equalUnder fn #231

Open Janiczek opened 7 months ago

Janiczek commented 7 months ago

Apply a function to both actual and expected before comparing them:

expectEqualUnder : (a -> b) -> a -> a -> Expectation
expectEqualUnder f a2 a1 =
    f a1
        |> Expect.equal (f a2)

Example of usage:

str
  |> thereAndBack
  |> expectEqualUnder String.trim str