chore(tests): fix test of audit types

This commit is contained in:
Gregor Kleen 2019-07-03 17:05:33 +02:00
parent 78e4369afb
commit fe103d3c3b
3 changed files with 11 additions and 22 deletions

View File

@ -11,4 +11,4 @@ if [[ -d .stack-work-test ]]; then
trap move-back EXIT trap move-back EXIT
fi fi
exec -- stack build --test --coverage --fast --flag uniworx:dev --flag uniworx:library-only ${@} stack build --test --coverage --fast --flag uniworx:dev --flag uniworx:library-only ${@}

View File

@ -8,7 +8,6 @@ import Settings
import Control.Lens (review, preview) import Control.Lens (review, preview)
import Data.Aeson (Value) import Data.Aeson (Value)
import qualified Data.Aeson as Aeson import qualified Data.Aeson as Aeson
import Data.Word (Word16)
import MailSpec () import MailSpec ()
@ -24,6 +23,8 @@ import qualified Data.Set as Set
import Time.Types (WeekDay(..)) import Time.Types (WeekDay(..))
import qualified Net.IP as IP
instance (Arbitrary a, MonoFoldable a) => Arbitrary (NonNull a) where instance (Arbitrary a, MonoFoldable a) => Arbitrary (NonNull a) where
arbitrary = arbitrary `suchThatMap` fromNullable arbitrary = arbitrary `suchThatMap` fromNullable
@ -185,20 +186,12 @@ instance Arbitrary LecturerType where
arbitrary = genericArbitrary arbitrary = genericArbitrary
shrink = genericShrink shrink = genericShrink
instance Arbitrary StdMethod where instance Arbitrary IP where
arbitrary = genericArbitrary arbitrary = oneof
shrink = genericShrink [ IP.ipv4 <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
, IP.ipv6 <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
]
instance Arbitrary SockAddr where
arbitrary = genericArbitrary
shrink = genericShrink
instance Arbitrary PortNumber where
arbitrary = (fromIntegral :: Word16 -> PortNumber) <$> arbitrary
instance Arbitrary RequestInfo where
arbitrary = genericArbitrary
shrink = genericShrink
instance {-# OVERLAPPABLE #-} ToBackendKey SqlBackend record => Arbitrary (Key record) where instance {-# OVERLAPPABLE #-} ToBackendKey SqlBackend record => Arbitrary (Key record) where
arbitrary = toSqlKey <$> arbitrary arbitrary = toSqlKey <$> arbitrary
shrink = map toSqlKey . shrink . fromSqlKey shrink = map toSqlKey . shrink . fromSqlKey
@ -284,14 +277,8 @@ spec = do
[ eqLaws, ordLaws, showReadLaws, jsonLaws, persistFieldLaws ] [ eqLaws, ordLaws, showReadLaws, jsonLaws, persistFieldLaws ]
lawsCheckHspec (Proxy @LecturerType) lawsCheckHspec (Proxy @LecturerType)
[ eqLaws, ordLaws, showReadLaws, boundedEnumLaws, finiteLaws, jsonLaws, pathPieceLaws, persistFieldLaws ] [ eqLaws, ordLaws, showReadLaws, boundedEnumLaws, finiteLaws, jsonLaws, pathPieceLaws, persistFieldLaws ]
lawsCheckHspec (Proxy @StdMethod) lawsCheckHspec (Proxy @IP)
[ eqLaws, ordLaws, showReadLaws, jsonLaws ] [ eqLaws, ordLaws, showReadLaws, jsonLaws ]
lawsCheckHspec (Proxy @SockAddr)
[ eqLaws, ordLaws, jsonLaws ]
lawsCheckHspec (Proxy @PortNumber)
[ eqLaws, ordLaws, showReadLaws, jsonLaws ]
lawsCheckHspec (Proxy @RequestInfo)
[ eqLaws, ordLaws, jsonLaws, persistFieldLaws ]
describe "TermIdentifier" $ do describe "TermIdentifier" $ do
it "has compatible encoding/decoding to/from Text" . property $ it "has compatible encoding/decoding to/from Text" . property $

View File

@ -36,6 +36,8 @@ import Numeric.Natural as X
import Control.Lens as X hiding ((<.), elements) import Control.Lens as X hiding ((<.), elements)
import Net.IP as X (IP)
import Database (truncateDb) import Database (truncateDb)
import Database as X (fillDb) import Database as X (fillDb)