Add test for introspection as subscription root

Add a pending test checking that an introspection field cannot be
subscription root.
This commit is contained in:
Eugen Wissner 2024-11-10 22:23:54 +01:00
parent 27a5a0b44e
commit 2dcefff76a
Signed by: belka
GPG Key ID: A27FDC1E8EE902C0

View File

@ -18,7 +18,7 @@ import qualified Language.GraphQL.AST.DirectiveLocation as DirectiveLocation
import qualified Language.GraphQL.Type.In as In
import qualified Language.GraphQL.Type.Out as Out
import Language.GraphQL.Validate
import Test.Hspec (Spec, context, describe, it, shouldBe, shouldContain)
import Test.Hspec (Spec, context, describe, it, shouldBe, shouldContain, xit)
import Text.Megaparsec (parse, errorBundlePretty)
petSchema :: Schema IO
@ -206,6 +206,18 @@ spec =
}
in validate queryString `shouldContain` [expected]
xit "rejects an introspection field as the subscription root" $
let queryString = "subscription sub {\n\
\ __typename\n\
\}"
expected = Error
{ message =
"Subscription \"sub\" must select only one top \
\level field."
, locations = [AST.Location 1 1]
}
in validate queryString `shouldContain` [expected]
it "rejects multiple subscription root fields coming from a fragment" $
let queryString = "subscription sub {\n\
\ ...multipleSubscriptions\n\