fradrive/test/FoundationSpec.hs
2019-05-19 13:55:56 +02:00

53 lines
1.2 KiB
Haskell

module FoundationSpec where
import TestImport
import ModelSpec ()
import qualified Data.CryptoID as CID
import Yesod.EmbeddedStatic
instance Arbitrary (Route Auth) where
arbitrary = oneof
[ return CheckR
, return LoginR
, return LogoutR
, PluginR <$> arbitrary <*> arbitrary
]
instance Arbitrary (Route EmbeddedStatic) where
arbitrary = embeddedResourceR <$> arbitrary <*> arbitrary
instance Arbitrary CourseR where
arbitrary = genericArbitrary
shrink = genericShrink
instance Arbitrary SheetR where
arbitrary = genericArbitrary
shrink = genericShrink
instance Arbitrary SubmissionR where
arbitrary = genericArbitrary
shrink = genericShrink
instance Arbitrary MaterialR where
arbitrary = genericArbitrary
shrink = genericShrink
instance Arbitrary TutorialR where
arbitrary = genericArbitrary
shrink = genericShrink
instance Arbitrary (Route UniWorX) where
arbitrary = genericArbitrary
shrink = genericShrink
instance Arbitrary a => Arbitrary (CID.CryptoID ns a) where
arbitrary = CID.CryptoID <$> arbitrary
spec :: Spec
spec = do
parallel $
lawsCheckHspec (Proxy @(Route UniWorX))
[ eqLaws, hashableLaws, jsonLaws, jsonKeyLaws, pathPieceLaws ]