Skip to content

Commit

Permalink
Fixed for Aeson >= 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Michel Boucey committed Oct 23, 2021
1 parent 8f810b1 commit d0741b2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/hspec.hs
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}

import Data.Aeson
import Data.HashMap.Strict
import Database.Cayley.Client as C
import Database.Cayley.Types as CT
import Test.Hspec
#if MIN_VERSION_aeson(2,0,0)
import qualified Data.Aeson.Key as K
import qualified Data.Aeson.KeyMap as KM
#endif

main :: IO ()
main = hspec $ do

describe "write" $
it "writes a quad to Cayley server" $ do
c <- connectCayley defaultCayleyConfig
#if MIN_VERSION_aeson(2,0,0)
write c Quad { subject = "<danny>", predicate = "<follows>", C.object = "<sandy>", label = Nothing } `shouldReturn` Just (Object (KM.fromList [("result",String "Successfully wrote 1 quads.")]))
#else
write c Quad { subject = "<danny>", predicate = "<follows>", C.object = "<sandy>", label = Nothing } `shouldReturn` Just (Object (fromList [("result",String "Successfully wrote 1 quads.")]))
#endif

describe "query" $
it "query Cayley server" $ do
Expand Down

0 comments on commit d0741b2

Please sign in to comment.