diff options
| author | Eugen Wissner <belka@caraus.de> | 2024-11-10 22:23:54 +0100 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2024-11-10 22:23:54 +0100 |
| commit | 2dcefff76ad4b889a386f3431baa9ee2b4c80568 (patch) | |
| tree | 48fe2c670f029430b1c6618a607a66870a15b601 | |
| parent | 27a5a0b44eb8568c53039f982c98cd07c3aef3c2 (diff) | |
| download | graphql-2dcefff76ad4b889a386f3431baa9ee2b4c80568.tar.gz | |
Add test for introspection as subscription root
Add a pending test checking that an introspection field cannot be
subscription root.
| -rw-r--r-- | tests/Language/GraphQL/Validate/RulesSpec.hs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/Language/GraphQL/Validate/RulesSpec.hs b/tests/Language/GraphQL/Validate/RulesSpec.hs index 02f2cde..af3b38e 100644 --- a/tests/Language/GraphQL/Validate/RulesSpec.hs +++ b/tests/Language/GraphQL/Validate/RulesSpec.hs @@ -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\ |
