mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-25 16:36:31 +03:00
b24b12b2e6
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5304 GitOrigin-RevId: 8238c1b59c378b7fe37ae0c9afecbf04f8841e2e
19 lines
873 B
Haskell
19 lines
873 B
Haskell
module Test.CapabilitiesSpec (spec) where
|
|
|
|
import Hasura.Backends.DataConnector.API (Capabilities, CapabilitiesResponse (..), Config, Routes (..), validateConfigAgainstConfigSchema)
|
|
import Servant.API (NamedRoutes)
|
|
import Servant.Client (Client, (//))
|
|
import Test.Expectations (jsonShouldBe)
|
|
import Test.Hspec (Spec, describe, it)
|
|
import Prelude
|
|
|
|
spec :: Client IO (NamedRoutes Routes) -> Config -> Capabilities -> Spec
|
|
spec api config expectedCapabilities = describe "capabilities API" $ do
|
|
it "returns the expected capabilities" $ do
|
|
CapabilitiesResponse capabilities _ <- api // _capabilities
|
|
capabilities `jsonShouldBe` expectedCapabilities
|
|
|
|
it "returns a schema that can be used to validate the current config" $ do
|
|
CapabilitiesResponse _ configSchema <- api // _capabilities
|
|
validateConfigAgainstConfigSchema configSchema config `jsonShouldBe` []
|