diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/Language/GraphQL/AST/EncoderSpec.hs | 2 | ||||
| -rw-r--r-- | tests/Language/GraphQL/ValidateSpec.hs | 19 |
2 files changed, 19 insertions, 2 deletions
diff --git a/tests/Language/GraphQL/AST/EncoderSpec.hs b/tests/Language/GraphQL/AST/EncoderSpec.hs index 5fa3706..85add18 100644 --- a/tests/Language/GraphQL/AST/EncoderSpec.hs +++ b/tests/Language/GraphQL/AST/EncoderSpec.hs @@ -122,7 +122,7 @@ spec = do describe "definition" $ it "indents block strings in arguments" $ let arguments = [Argument "message" (String "line1\nline2")] - field = Field Nothing "field" arguments [] [] + field = Field Nothing "field" arguments [] [] $ Location 0 0 operation = DefinitionOperation $ SelectionSet (pure field) $ Location 0 0 diff --git a/tests/Language/GraphQL/ValidateSpec.hs b/tests/Language/GraphQL/ValidateSpec.hs index eef5d38..990555e 100644 --- a/tests/Language/GraphQL/ValidateSpec.hs +++ b/tests/Language/GraphQL/ValidateSpec.hs @@ -300,7 +300,7 @@ spec = } in validate queryString `shouldBe` Seq.singleton expected - it "rejects the fragment spread without a target" $ + it "rejects fragment spreads without an unknown target type" $ let queryString = [r| { dog { @@ -319,3 +319,20 @@ spec = , path = [] } in validate queryString `shouldBe` Seq.singleton expected + + it "rejects inline fragments without a target" $ + let queryString = [r| + { + ... on NotInSchema { + name + } + } + |] + expected = Error + { message = + "Inline fragment is specified on type \"NotInSchema\" \ + \which doesn't exist in the schema." + , locations = [AST.Location 3 17] + , path = [] + } + in validate queryString `shouldBe` Seq.singleton expected |
