summaryrefslogtreecommitdiff
path: root/tests/Language
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2023-01-10 09:53:18 +0100
committerEugen Wissner <belka@caraus.de>2023-01-10 09:53:18 +0100
commit9021f3a25d2b474160abae58cd98c4b6d08d87d0 (patch)
treeab75aadbade95707fbf645ae56b5241e6a9fbd58 /tests/Language
parent025331a9ee07bd3080de6be0f5d514118052d1b5 (diff)
downloadgraphql-9021f3a25d2b474160abae58cd98c4b6d08d87d0.tar.gz
Encode input object types
Diffstat (limited to 'tests/Language')
-rw-r--r--tests/Language/GraphQL/AST/EncoderSpec.hs18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/Language/GraphQL/AST/EncoderSpec.hs b/tests/Language/GraphQL/AST/EncoderSpec.hs
index a4ba470..3fa6a02 100644
--- a/tests/Language/GraphQL/AST/EncoderSpec.hs
+++ b/tests/Language/GraphQL/AST/EncoderSpec.hs
@@ -249,3 +249,21 @@ spec = do
|]
actual = typeSystemDefinition pretty definition'
in actual `shouldBe` expected
+
+ it "encodes an input type" $
+ let intType = Full.TypeNonNull $ Full.NonNullTypeNamed "Int"
+ stringType = Full.TypeNamed "String"
+ fields =
+ [ Full.InputValueDefinition mempty "a" stringType Nothing mempty
+ , Full.InputValueDefinition mempty "b" intType Nothing mempty
+ ]
+ definition' = Full.TypeDefinition
+ $ Full.InputObjectTypeDefinition mempty "ExampleInputObject" mempty fields
+ expected = [gql|
+ input ExampleInputObject {
+ a: String
+ b: Int!
+ }
+ |]
+ actual = typeSystemDefinition pretty definition'
+ in actual `shouldBe` expected