Validate anonymous operation definitions

This commit is contained in:
2020-08-26 18:58:48 +02:00
parent 7355533268
commit e6a6926e18
5 changed files with 64 additions and 12 deletions

View File

@ -209,3 +209,27 @@ spec =
, path = []
}
in validate queryString `shouldBe` Seq.singleton expected
it "rejects multiple anonymous operations" $
let queryString = [r|
{
dog {
name
}
}
query getName {
dog {
owner {
name
}
}
}
|]
expected = Error
{ message =
"This anonymous operation must be the only defined operation."
, locations = [AST.Location 2 15]
, path = []
}
in validate queryString `shouldBe` Seq.singleton expected