mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-16 01:44:03 +03:00
dc83352863
[GDC-487]: https://hasurahq.atlassian.net/browse/GDC-487?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ [GDC-488]: https://hasurahq.atlassian.net/browse/GDC-488?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8182 GitOrigin-RevId: 712953666e1a5ea07500f1e1aed669f27650f7a4
26 lines
849 B
Haskell
26 lines
849 B
Haskell
{-# LANGUAGE QuasiQuotes #-}
|
|
|
|
module Hasura.Backends.DataConnector.API.V0.ScalarSpec (spec, genScalarType, genScalarValue) where
|
|
|
|
import Data.Aeson.QQ.Simple (aesonQQ)
|
|
import Hasura.Backends.DataConnector.API.V0.Scalar
|
|
import Hasura.Generator.Common (defaultRange, genArbitraryAlphaNumTextExcluding)
|
|
import Hasura.Prelude
|
|
import Hedgehog
|
|
import Test.Aeson.Utils
|
|
import Test.Hspec
|
|
|
|
spec :: Spec
|
|
spec = do
|
|
describe "ScalarType" $ do
|
|
testToFromJSONToSchema (ScalarType "foo") [aesonQQ|"foo"|]
|
|
jsonOpenApiProperties genScalarType
|
|
|
|
genScalarType :: (MonadGen m, GenBase m ~ Identity) => m ScalarType
|
|
genScalarType =
|
|
ScalarType
|
|
<$> genArbitraryAlphaNumTextExcluding ["string", "number", "bool"] defaultRange
|
|
|
|
genScalarValue :: (MonadGen m, GenBase m ~ Identity) => m ScalarValue
|
|
genScalarValue = ScalarValue <$> genValue <*> genScalarType
|