Building a Web app with FP - Part III - Test Test Test ✅

Part 3 of writing a web app with FP is up https://matsumonkie.fr/post/3
It’s about testing with servant, hspec, and ghcid.

2 Likes

Thank you, it was very interesting :slight_smile: It took me a minute to figure out that the :<|> syntax is this snippet is not like defining an operator but rather had a similar function to (,)

getWeatherHandler :<|> setWeatherHandler =
  Servant.client (Proxy :: Proxy WeatherApi)

One thing is not entirely clear to me - you seem to use the same database for both development and testing, Is that right? Shouldn’t they be separated?

btw it’s worth mentioning that module names has to end with Spec for hspec to discover them. I lost 20 minutes or so figuring it out recently :sweat_smile:

2 Likes

Good points, I edited the article to explain them, thanks @gilmi!

That is correct, I plan to split the development/test database in the next article :slight_smile:

1 Like