2022-04-10 07:47:15 +03:00
|
|
|
module Test.QuerySpec (spec) where
|
|
|
|
|
|
|
|
import Control.Monad (when)
|
2022-06-16 11:30:01 +03:00
|
|
|
import Data.Maybe (isJust)
|
2022-09-21 13:46:46 +03:00
|
|
|
import Hasura.Backends.DataConnector.API (Capabilities (..), ComparisonCapabilities (..), Config, Routes (..), SourceName)
|
2022-04-10 07:47:15 +03:00
|
|
|
import Servant.API (NamedRoutes)
|
|
|
|
import Servant.Client (Client)
|
2022-09-28 02:41:21 +03:00
|
|
|
import Test.Data (TestData)
|
2022-04-10 07:47:15 +03:00
|
|
|
import Test.Hspec
|
2022-07-28 08:39:48 +03:00
|
|
|
import Test.QuerySpec.AggregatesSpec qualified
|
2022-04-10 07:47:15 +03:00
|
|
|
import Test.QuerySpec.BasicSpec qualified
|
2022-09-20 06:59:47 +03:00
|
|
|
import Test.QuerySpec.FilteringSpec qualified
|
2022-08-19 10:00:46 +03:00
|
|
|
import Test.QuerySpec.OrderBySpec qualified
|
2022-04-10 07:47:15 +03:00
|
|
|
import Test.QuerySpec.RelationshipsSpec qualified
|
|
|
|
import Prelude
|
|
|
|
|
2022-09-28 02:41:21 +03:00
|
|
|
spec :: TestData -> Client IO (NamedRoutes Routes) -> SourceName -> Config -> Capabilities -> Spec
|
|
|
|
spec testData api sourceName config capabilities@Capabilities {..} = do
|
2022-04-10 07:47:15 +03:00
|
|
|
describe "query API" do
|
2022-09-28 02:41:21 +03:00
|
|
|
Test.QuerySpec.BasicSpec.spec testData api sourceName config
|
|
|
|
Test.QuerySpec.FilteringSpec.spec testData api sourceName config _cComparisons
|
|
|
|
Test.QuerySpec.OrderBySpec.spec testData api sourceName config capabilities
|
2022-09-21 08:11:53 +03:00
|
|
|
when (isJust _cRelationships) $
|
2022-09-28 02:41:21 +03:00
|
|
|
Test.QuerySpec.RelationshipsSpec.spec testData api sourceName config (_cComparisons >>= _ccSubqueryComparisonCapabilities)
|
|
|
|
Test.QuerySpec.AggregatesSpec.spec testData api sourceName config _cRelationships
|