module FoundationSpec where import TestImport import ModelSpec () 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 = do let printableText = pack . filter (/= '/') . getPrintableString <$> arbitrary printableText' = printableText `suchThat` (not . null) pathLength <- getPositive <$> arbitrary path <- replicateM pathLength printableText' paramNum <- getNonNegative <$> arbitrary params <- replicateM paramNum $ (,) <$> printableText' <*> printableText return $ embeddedResourceR path params instance Arbitrary WellKnownFileName where arbitrary = genericArbitrary shrink = genericShrink instance Arbitrary SchoolR where arbitrary = genericArbitrary shrink = genericShrink 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 ExamR where arbitrary = genericArbitrary shrink = genericShrink instance Arbitrary CourseApplicationR where arbitrary = genericArbitrary shrink = genericShrink instance Arbitrary AllocationR where arbitrary = genericArbitrary shrink = genericShrink instance Arbitrary ExamOfficeR where arbitrary = genericArbitrary shrink = genericShrink instance Arbitrary EExamR where arbitrary = genericArbitrary shrink = genericShrink instance Arbitrary CourseNewsR where arbitrary = genericArbitrary shrink = genericShrink instance Arbitrary CourseEventR where arbitrary = genericArbitrary shrink = genericShrink instance Arbitrary AdminWorkflowDefinitionR where arbitrary = genericArbitrary shrink = genericShrink instance Arbitrary AdminWorkflowInstanceR where arbitrary = genericArbitrary shrink = genericShrink instance Arbitrary GlobalWorkflowInstanceR where arbitrary = genericArbitrary shrink = genericShrink instance Arbitrary GlobalWorkflowWorkflowR where arbitrary = genericArbitrary shrink = genericShrink instance Arbitrary SchoolWorkflowInstanceR where arbitrary = genericArbitrary shrink = genericShrink instance Arbitrary SchoolWorkflowWorkflowR where arbitrary = genericArbitrary shrink = genericShrink instance Arbitrary (Route UniWorX) where arbitrary = genericArbitrary shrink = genericShrink spec :: Spec spec = do parallel $ lawsCheckHspec (Proxy @(Route UniWorX)) [ eqLaws, hashableLaws, jsonLaws, jsonKeyLaws, pathPieceLaws ]