module Handler.Exam.FormSpec where

import TestImport
import ModelSpec ()
import CryptoID

import Handler.Exam.Form


instance Arbitrary ExamOccurrenceForm where
  arbitrary = ExamOccurrenceForm
    <$> (fmap (view _2) <$> (arbitrary :: Gen (Maybe (ExamOccurrenceId, CryptoUUIDExamOccurrence))))
    <*> arbitrary
    <*> arbitrary
    <*> arbitrary
    <*> arbitrary
    <*> arbitrary
    <*> arbitrary
    <*> arbitrary

instance Arbitrary ExamPartForm where
  arbitrary = ExamPartForm
    <$> (fmap (view _2) <$> (arbitrary :: Gen (Maybe (ExamPartId, CryptoUUIDExamPart))))
    <*> arbitrary
    <*> arbitrary
    <*> arbitrary
    <*> arbitrary


spec :: Spec
spec = do
  parallel $ do
    lawsCheckHspec (Proxy @ExamOccurrenceForm)
      [ eqLaws, ordLaws ]
    lawsCheckHspec (Proxy @ExamPartForm)
      [ eqLaws, ordLaws ]
