graphql/tests/Language/GraphQL/ParserSpec.hs
2019-09-06 07:48:01 +02:00

31 lines
831 B
Haskell

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
module Language.GraphQL.ParserSpec
( spec
) where
import Data.Either (isRight)
import Language.GraphQL.Parser (document)
import Test.Hspec ( Spec
, describe
, it
, shouldSatisfy
)
import Text.Megaparsec (parse)
import Text.RawString.QQ (r)
spec :: Spec
spec = describe "Parser" $ do
it "accepts BOM header" $
parse document "" "\xfeff{foo}" `shouldSatisfy` isRight
it "accepts block strings as argument" $
parse document "" [r|{
hello(text: """Argument""")
}|] `shouldSatisfy` isRight
it "accepts strings as argument" $
parse document "" [r|{
hello(text: "Argument")
}|] `shouldSatisfy` isRight