mirror of
https://github.com/ilyakooo0/servant-quickcheck.git
synced 2024-11-22 05:42:11 +03:00
not really known
0190e5e737
This commit relaxes the bounds on QuickCheck, allowing it to be compatible with 2.12. In order to be compatible with 2.12, we had to CPP some definitions that referenced code that was deleted. |
||
---|---|---|
doc | ||
example | ||
src/Servant | ||
test | ||
.gitignore | ||
.travis.yml | ||
CHANGELOG.yaml | ||
LICENSE | ||
README.md | ||
servant-quickcheck.cabal | ||
Setup.hs | ||
stack.yaml |
servant-quickcheck
servant-quickcheck
provides tools to test properties across entire APIs.
Rather than writing the same tests for each endpoint, with servant-quickcheck
you can simply specify properties every endpoint must meet once and for all.
For example:
followsBestPractices :: Spec
followsBestPractices = describe "my API" $ do
it "follows best practices" $ do
withServantServer myAPI myServer $ \burl ->
serverSatisfies api burl stdArgs
( not500
<%> onlyJsonObjects
<%> getsHaveCacheControlHeader
<%> headsHaveCacheControlHeader
<%> mempty)
Additionally, servant-quickcheck
provides a serversEqual
function that
generates arbitrary requests (that conform to the description of an API) and
tests that two servers respond identically to them. This can be useful when
refactoring or rewriting an API that should not change.