chore(tests): fix test of audit types
This commit is contained in:
parent
78e4369afb
commit
fe103d3c3b
2
test.sh
2
test.sh
@ -11,4 +11,4 @@ if [[ -d .stack-work-test ]]; then
|
||||
trap move-back EXIT
|
||||
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 ${@}
|
||||
|
||||
@ -8,7 +8,6 @@ import Settings
|
||||
import Control.Lens (review, preview)
|
||||
import Data.Aeson (Value)
|
||||
import qualified Data.Aeson as Aeson
|
||||
import Data.Word (Word16)
|
||||
|
||||
import MailSpec ()
|
||||
|
||||
@ -24,6 +23,8 @@ import qualified Data.Set as Set
|
||||
|
||||
import Time.Types (WeekDay(..))
|
||||
|
||||
import qualified Net.IP as IP
|
||||
|
||||
|
||||
instance (Arbitrary a, MonoFoldable a) => Arbitrary (NonNull a) where
|
||||
arbitrary = arbitrary `suchThatMap` fromNullable
|
||||
@ -185,20 +186,12 @@ instance Arbitrary LecturerType where
|
||||
arbitrary = genericArbitrary
|
||||
shrink = genericShrink
|
||||
|
||||
instance Arbitrary StdMethod where
|
||||
arbitrary = genericArbitrary
|
||||
shrink = genericShrink
|
||||
instance Arbitrary IP where
|
||||
arbitrary = oneof
|
||||
[ 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
|
||||
arbitrary = toSqlKey <$> arbitrary
|
||||
shrink = map toSqlKey . shrink . fromSqlKey
|
||||
@ -284,14 +277,8 @@ spec = do
|
||||
[ eqLaws, ordLaws, showReadLaws, jsonLaws, persistFieldLaws ]
|
||||
lawsCheckHspec (Proxy @LecturerType)
|
||||
[ eqLaws, ordLaws, showReadLaws, boundedEnumLaws, finiteLaws, jsonLaws, pathPieceLaws, persistFieldLaws ]
|
||||
lawsCheckHspec (Proxy @StdMethod)
|
||||
lawsCheckHspec (Proxy @IP)
|
||||
[ 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
|
||||
it "has compatible encoding/decoding to/from Text" . property $
|
||||
|
||||
@ -36,6 +36,8 @@ import Numeric.Natural as X
|
||||
|
||||
import Control.Lens as X hiding ((<.), elements)
|
||||
|
||||
import Net.IP as X (IP)
|
||||
|
||||
import Database (truncateDb)
|
||||
import Database as X (fillDb)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user