Add singleError utility function

This commit is contained in:
2019-07-23 06:04:33 +02:00
parent 1b5094b6a3
commit 282946560e
6 changed files with 64 additions and 15 deletions

View File

@ -0,0 +1,24 @@
{-# LANGUAGE OverloadedStrings #-}
module Language.GraphQL.ErrorSpec
( spec
) where
import qualified Data.Aeson as Aeson
import Language.GraphQL.Error
import Test.Hspec ( Spec
, describe
, it
, shouldBe
)
spec :: Spec
spec = describe "singleError" $
it "constructs an error with the given message" $
let expected = Aeson.object
[
("errors", Aeson.toJSON
[ Aeson.object [("message", "Message.")]
]
)
]
in singleError "Message." `shouldBe` expected