diff --git a/test/Servant/QuickCheck/InternalSpec.hs b/test/Servant/QuickCheck/InternalSpec.hs index 76ef168..b7188d4 100644 --- a/test/Servant/QuickCheck/InternalSpec.hs +++ b/test/Servant/QuickCheck/InternalSpec.hs @@ -71,12 +71,18 @@ serversEqualSpec = describe "serversEqual" $ do context "when JSON is equal but looks a bit different as a ByteString" $ do - it "considers equal JSON apis equal regardless of ordering or whitespace" $ do + it "sanity check: different whitespace same JSON objects bodyEquality fails" $ do + Right (Failure _ err) <- withServantServer jsonApi jsonServer1 $ \burl1 -> + withServantServer jsonApi jsonServer2 $ \burl2 -> do + safeEvalExample $ serversEqual jsonApi burl1 burl2 args bodyEquality + show err `shouldContain` "Server equality failed" + + it "jsonEquality considers equal JSON apis equal regardless of key ordering or whitespace" $ do withServantServerAndContext jsonApi ctx jsonServer1 $ \burl1 -> withServantServerAndContext jsonApi ctx jsonServer2 $ \burl2 -> serversEqual jsonApi burl1 burl2 args jsonEquality - it "sees when JSON apis are not equal regardless of ordering or whitespace" $ do + it "sees when JSON apis are not equal because any value is different" $ do Right (Failure _ err) <- withServantServer jsonApi jsonServer2 $ \burl1 -> withServantServer jsonApi jsonServer3 $ \burl2 -> do safeEvalExample $ serversEqual jsonApi burl1 burl2 args jsonEquality