2020-09-17 13:56:41 +03:00
|
|
|
-- | basic tests on NonNegativeIntType
|
2021-08-17 01:19:24 +03:00
|
|
|
module Data.NonNegativeIntSpec (spec) where
|
2020-09-17 13:56:41 +03:00
|
|
|
|
|
|
|
import Prelude
|
|
|
|
|
|
|
|
import Hasura.RQL.Types.Common (mkNonNegativeInt)
|
|
|
|
|
|
|
|
import Test.Hspec (Spec, describe, it, shouldBe)
|
|
|
|
|
|
|
|
spec :: Spec
|
|
|
|
spec = do
|
|
|
|
nonNegIntSpec
|
|
|
|
|
|
|
|
nonNegIntSpec :: Spec
|
|
|
|
nonNegIntSpec =
|
|
|
|
describe "non negative integer type" $ do
|
|
|
|
it "only validates non negative integers" $ do
|
2020-10-28 19:40:33 +03:00
|
|
|
mkNonNegativeInt 23 `shouldBe` Just 23
|
|
|
|
mkNonNegativeInt (-23) `shouldBe` Nothing
|
2020-09-17 13:56:41 +03:00
|
|
|
|
2020-10-28 19:40:33 +03:00
|
|
|
-- TODO: add spec for fromJSON for NonNegativeInt type
|