From a96d4e6ef3b1020d239f0061af5861aadeb278fc Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Tue, 27 Dec 2022 10:37:34 +0100 Subject: Add Semigroup and Monoid instances for Description --- tests/Language/GraphQL/AST/DocumentSpec.hs | 6 ++++++ tests/Language/GraphQL/AST/EncoderSpec.hs | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'tests/Language') diff --git a/tests/Language/GraphQL/AST/DocumentSpec.hs b/tests/Language/GraphQL/AST/DocumentSpec.hs index ca13e17..d09d6b1 100644 --- a/tests/Language/GraphQL/AST/DocumentSpec.hs +++ b/tests/Language/GraphQL/AST/DocumentSpec.hs @@ -18,3 +18,9 @@ spec = do ] expected = "{ field1: 1.2, field2: null }" in show object `shouldBe` expected + + describe "Description" $ + it "keeps content when merging with no description" $ + let expected = Description $ Just "Left description" + actual = expected <> Description Nothing + in actual `shouldBe` expected diff --git a/tests/Language/GraphQL/AST/EncoderSpec.hs b/tests/Language/GraphQL/AST/EncoderSpec.hs index c654c0b..6b424d5 100644 --- a/tests/Language/GraphQL/AST/EncoderSpec.hs +++ b/tests/Language/GraphQL/AST/EncoderSpec.hs @@ -180,7 +180,7 @@ spec = do let actual = operationType pretty Full.Mutation in actual `shouldBe` "mutation" - describe "typeSystemDefinition" $ + describe "typeSystemDefinition" $ do it "produces a schema with an indented operation type definition" $ let queryType = Full.OperationTypeDefinition Full.Query "QueryRootType" mutationType = Full.OperationTypeDefinition Full.Mutation "MutationType" @@ -194,3 +194,10 @@ spec = do |] '\n' actual = typeSystemDefinition pretty definition' in actual `shouldBe` expected + + it "encodes a scalar type definition" $ + let uuidType = Full.ScalarTypeDefinition mempty "UUID" mempty + definition' = Full.TypeDefinition uuidType + expected = "scalar UUID" + actual = typeSystemDefinition pretty definition' + in actual `shouldBe` expected -- cgit v1.2.3