mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-20 05:51:54 +03:00
38c41b2ae6
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4175 GitOrigin-RevId: d37d7d131597af6b9cca6bd773c8dbbce8719ca5
21 lines
790 B
Haskell
21 lines
790 B
Haskell
module Test.SchemaSpec (spec) where
|
|
|
|
import Data.List (sortOn)
|
|
import Hasura.Backends.DataWrapper.API (Capabilities, Routes (..), SchemaResponse (..), TableInfo (..))
|
|
import Servant.API (NamedRoutes)
|
|
import Servant.Client (Client, (//))
|
|
import Test.Data qualified as Data
|
|
import Test.Hspec (Spec, describe, it)
|
|
import Test.Hspec.Expectations.Pretty (shouldBe)
|
|
import Prelude
|
|
|
|
spec :: Client IO (NamedRoutes Routes) -> Capabilities -> Spec
|
|
spec api expectedCapabilities = describe "schema API" $ do
|
|
it "returns the expected capabilities" $ do
|
|
capabilities <- fmap srCapabilities $ api // _schema
|
|
capabilities `shouldBe` expectedCapabilities
|
|
|
|
it "returns Chinook schema" $ do
|
|
tables <- fmap (sortOn dtiName . srTables) $ api // _schema
|
|
tables `shouldBe` Data.schemaTables
|