Validate fragment spread type existence

This commit is contained in:
2020-09-05 10:00:58 +02:00
parent 14ed209828
commit d327d9d1ce
9 changed files with 66 additions and 30 deletions

View File

@ -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

View File

@ -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