chore: fix tests

This commit is contained in:
Gregor Kleen 2021-05-19 21:34:59 +02:00
parent 575fadcd8c
commit 566e69e835

View File

@ -16,7 +16,7 @@ import qualified Data.Set as Set
import qualified Data.Aeson as Aeson
import Control.Lens.Extras (is)
import Utils.Lens
import Utils.I18n
@ -119,8 +119,17 @@ instance (Arbitrary fileid, Arbitrary userid, Ord fileid, Typeable userid, Typea
instance (Arbitrary payload, IsWorkflowFieldPayload' fileid userid payload) => Arbitrary (WorkflowFieldPayload fileid userid payload) where
arbitrary = review _WorkflowFieldPayload <$> arbitrary
instance (Arbitrary termid, Arbitrary schoolid, Arbitrary courseid) => Arbitrary (WorkflowScope termid schoolid courseid) where
arbitrary = genericArbitrary
instance (Arbitrary termid, Arbitrary courseid) => Arbitrary (WorkflowScope termid SchoolShorthand courseid) where
arbitrary = oneof
[ pure WSGlobal
, WSTerm <$> arbitrary
, WSSchool <$> arbitrarySchoolShorthand
, WSTermSchool <$> arbitrary <*> arbitrarySchoolShorthand
, WSCourse <$> arbitrary
]
where arbitrarySchoolShorthand = CI.mk . pack <$> (fmap getPrintableString arbitrary `suchThat` (not . null))
instance (Arbitrary termid, Arbitrary courseid) => Arbitrary (WorkflowScope termid SchoolId courseid) where
arbitrary = over _wisSchool SchoolKey <$> arbitrary
instance (CoArbitrary termid, CoArbitrary schoolid, CoArbitrary courseid) => CoArbitrary (WorkflowScope termid schoolid courseid)
instance (Function termid, Function schoolid, Function courseid) => Function (WorkflowScope termid schoolid courseid)