mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-24 07:52:14 +03:00
88c5b14c3d
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5603 GitOrigin-RevId: b9255d265ceb88d96643c95f409387fb93df6676
68 lines
2.4 KiB
Haskell
68 lines
2.4 KiB
Haskell
{-# LANGUAGE OverloadedLists #-}
|
|
{-# LANGUAGE QuasiQuotes #-}
|
|
|
|
module Hasura.Backends.DataConnector.API.V0.CapabilitiesSpec (spec) where
|
|
|
|
import Data.Aeson.QQ.Simple (aesonQQ)
|
|
import Hasura.Backends.DataConnector.API.V0.Capabilities
|
|
import Hasura.Backends.DataConnector.API.V0.ConfigSchema
|
|
import Hasura.Prelude
|
|
import Hedgehog
|
|
import Hedgehog.Gen qualified as Gen
|
|
import Test.Aeson.Utils
|
|
import Test.Hspec
|
|
|
|
spec :: Spec
|
|
spec = do
|
|
describe "Capabilities" $ do
|
|
testToFromJSONToSchema emptyCapabilities [aesonQQ|{}|]
|
|
jsonOpenApiProperties genCapabilities
|
|
describe "CapabilitiesResponse" $ do
|
|
testToFromJSON
|
|
(CapabilitiesResponse (emptyCapabilities {cRelationships = Just RelationshipCapabilities {}}) emptyConfigSchemaResponse)
|
|
[aesonQQ|{"capabilities": {"relationships": {}}, "configSchemas": {"configSchema": {}, "otherSchemas": {}}}|]
|
|
|
|
genQueryCapabilities :: MonadGen m => m QueryCapabilities
|
|
genQueryCapabilities = QueryCapabilities <$> Gen.bool
|
|
|
|
genMutationCapabilities :: MonadGen m => m MutationCapabilities
|
|
genMutationCapabilities = pure MutationCapabilities {}
|
|
|
|
genSubscriptionCapabilities :: MonadGen m => m SubscriptionCapabilities
|
|
genSubscriptionCapabilities = pure SubscriptionCapabilities {}
|
|
|
|
genBooleanOperators :: MonadGen m => m BooleanOperators
|
|
genBooleanOperators = pure BooleanOperators {}
|
|
|
|
genComparisonOperators :: MonadGen m => m ComparisonOperators
|
|
genComparisonOperators = pure ComparisonOperators {}
|
|
|
|
genFilteringCapabilities :: MonadGen m => m FilteringCapabilities
|
|
genFilteringCapabilities =
|
|
FilteringCapabilities
|
|
<$> genBooleanOperators
|
|
<*> genComparisonOperators
|
|
|
|
genRelationshipCapabilities :: MonadGen m => m RelationshipCapabilities
|
|
genRelationshipCapabilities = pure RelationshipCapabilities {}
|
|
|
|
genMetricsCapabilities :: MonadGen m => m MetricsCapabilities
|
|
genMetricsCapabilities = pure MetricsCapabilities {}
|
|
|
|
genExplainCapabilities :: MonadGen m => m ExplainCapabilities
|
|
genExplainCapabilities = pure ExplainCapabilities {}
|
|
|
|
genCapabilities :: MonadGen m => m Capabilities
|
|
genCapabilities =
|
|
Capabilities
|
|
<$> Gen.maybe genQueryCapabilities
|
|
<*> Gen.maybe genMutationCapabilities
|
|
<*> Gen.maybe genSubscriptionCapabilities
|
|
<*> Gen.maybe genFilteringCapabilities
|
|
<*> Gen.maybe genRelationshipCapabilities
|
|
<*> Gen.maybe genMetricsCapabilities
|
|
<*> Gen.maybe genExplainCapabilities
|
|
|
|
emptyConfigSchemaResponse :: ConfigSchemaResponse
|
|
emptyConfigSchemaResponse = ConfigSchemaResponse mempty mempty
|