Validate fragment spread type existence
This commit is contained in:
@ -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
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user