diff options
| author | Eugen Wissner <belka@caraus.de> | 2020-09-07 22:01:49 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2020-09-07 22:01:49 +0200 |
| commit | f6ff0ab9c785273e3ceeac6b9d636c5ec519a008 (patch) | |
| tree | 4c77603d176d9d1383cf0a3ea3891648ed075b8c /tests | |
| parent | d327d9d1ce9670e51b7eef7a4272aaf3b6290228 (diff) | |
| download | graphql-f6ff0ab9c785273e3ceeac6b9d636c5ec519a008.tar.gz | |
Validate fragments on composite types
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/Language/GraphQL/ValidateSpec.hs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/Language/GraphQL/ValidateSpec.hs b/tests/Language/GraphQL/ValidateSpec.hs index 990555e..a95c4d6 100644 --- a/tests/Language/GraphQL/ValidateSpec.hs +++ b/tests/Language/GraphQL/ValidateSpec.hs @@ -336,3 +336,40 @@ spec = , path = [] } in validate queryString `shouldBe` Seq.singleton expected + + it "rejects fragments on scalar types" $ + let queryString = [r| + { + dog { + ...fragOnScalar + } + } + fragment fragOnScalar on Int { + name + } + |] + expected = Error + { message = + "Fragment cannot condition on non composite type \ + \\"Int\"." + , locations = [AST.Location 7 15] + , path = [] + } + in validate queryString `shouldBe` Seq.singleton expected + + it "rejects inline fragments on scalar types" $ + let queryString = [r| + { + ... on Boolean { + name + } + } + |] + expected = Error + { message = + "Fragment cannot condition on non composite type \ + \\"Boolean\"." + , locations = [AST.Location 3 17] + , path = [] + } + in validate queryString `shouldBe` Seq.singleton expected |
