summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Language/GraphQL/AST/EncoderSpec.hs24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/Language/GraphQL/AST/EncoderSpec.hs b/tests/Language/GraphQL/AST/EncoderSpec.hs
index 3fa6a02..37c6302 100644
--- a/tests/Language/GraphQL/AST/EncoderSpec.hs
+++ b/tests/Language/GraphQL/AST/EncoderSpec.hs
@@ -11,6 +11,7 @@ import Language.GraphQL.TH
import Test.Hspec (Spec, context, describe, it, shouldBe, shouldStartWith, shouldEndWith, shouldNotContain)
import Test.QuickCheck (choose, oneof, forAll)
import qualified Data.Text.Lazy as Text.Lazy
+import qualified Language.GraphQL.AST.DirectiveLocation as DirectiveLocation
spec :: Spec
spec = do
@@ -267,3 +268,26 @@ spec = do
|]
actual = typeSystemDefinition pretty definition'
in actual `shouldBe` expected
+
+ context "directive definition" $ do
+ it "encodes a directive definition" $ do
+ let definition' = Full.DirectiveDefinition mempty "example" mempty False
+ $ pure
+ $ DirectiveLocation.ExecutableDirectiveLocation DirectiveLocation.Field
+ expected = [gql|
+ @example() on
+ | FIELD
+ |]
+ actual = typeSystemDefinition pretty definition'
+ in actual `shouldBe` expected
+
+ it "encodes a repeatable directive definition" $ do
+ let definition' = Full.DirectiveDefinition mempty "example" mempty True
+ $ pure
+ $ DirectiveLocation.ExecutableDirectiveLocation DirectiveLocation.Field
+ expected = [gql|
+ @example() repeatable on
+ | FIELD
+ |]
+ actual = typeSystemDefinition pretty definition'
+ in actual `shouldBe` expected