summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-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