forked from OSS/graphql
		
	Test directive definition decoder
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user