Validate the subscription root
All checks were successful
Build / audit (push) Successful in 17s
Build / test (push) Successful in 6m33s
Build / doc (push) Successful in 5m45s

…not to be an introspection field.
This commit is contained in:
2024-12-01 21:47:29 +01:00
parent 2dcefff76a
commit 7ea76865e6
3 changed files with 26 additions and 21 deletions

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, xit)
import Test.Hspec (Spec, context, describe, it, shouldBe, shouldContain)
import Text.Megaparsec (parse, errorBundlePretty)
petSchema :: Schema IO
@ -206,14 +206,14 @@ spec =
}
in validate queryString `shouldContain` [expected]
xit "rejects an introspection field as the subscription root" $
it "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."
"Subscription \"sub\" must select exactly one top \
\level field, which must not be an introspection field."
, locations = [AST.Location 1 1]
}
in validate queryString `shouldContain` [expected]