diff --git a/test/Model/TypesSpec.hs b/test/Model/TypesSpec.hs index fe9eb7325..57ae987aa 100644 --- a/test/Model/TypesSpec.hs +++ b/test/Model/TypesSpec.hs @@ -1,4 +1,4 @@ --- SPDX-FileCopyrightText: 2022 Gregor Kleen ,Sarah Vaupel ,Steffen Jost ,Steffen Jost +-- SPDX-FileCopyrightText: 2022-24 Gregor Kleen ,Sarah Vaupel ,Steffen Jost ,Steffen Jost ,Steffen Jost -- -- SPDX-License-Identifier: AGPL-3.0-or-later @@ -66,8 +66,8 @@ instance Arbitrary Day where shrink day = let (y, m, d) = toGregorian day dayShrink = [fromGregorian y m (d - 1) | d > 1] - monthShrink = [fromGregorian y (m - 1) d | m > 1] - yearShrink = [fromGregorian (y - 1) m d | y > 2000] + monthShrink = [fromGregorian y (m - 1) d | m > 1] + yearShrink = [fromGregorian (y - 1) m d | y > 2000] in dayShrink ++ monthShrink ++ yearShrink instance CoArbitrary Day where @@ -75,7 +75,7 @@ instance CoArbitrary Day where -} instance Arbitrary TermIdentifier where - arbitrary = TermIdentifier <$> arbitrary + arbitrary = TermIdentifier <$> arbitrary shrink = fmap TermIdentifier . shrink . year instance CoArbitrary TermIdentifier instance Function TermIdentifier @@ -399,7 +399,7 @@ instance Arbitrary UploadNonce where instance Arbitrary SchoolAuthorshipStatementMode where arbitrary = genericArbitrary - + instance Arbitrary SheetAuthorshipStatementMode where arbitrary = genericArbitrary @@ -455,7 +455,7 @@ spec = do lawsCheckHspec (Proxy @TermIdentifier) [ eqLaws, showReadLaws, ordLaws, enumLaws, persistFieldLaws, jsonLaws, httpApiDataLaws, pathPieceLaws ] lawsCheckHspec (Proxy @Occurrences) - [ eqLaws, showReadLaws, ordLaws, jsonLaws, persistFieldLaws ] + [ eqLaws, ordLaws, jsonLaws, persistFieldLaws ] lawsCheckHspec (Proxy @StudyFieldType) [ eqLaws, ordLaws, boundedEnumLaws, showReadLaws, persistFieldLaws ] lawsCheckHspec (Proxy @Theme) @@ -541,11 +541,11 @@ spec = do describe "TermIdentifier" $ do it "has compatible encoding/decoding to/from Text" . property $ - \term -> termFromText (termToText term) == Right term + \term -> termFromText (termToText term) == Right term it "has compatible encoding/decoding to/from Rational" . property $ \term -> termFromRational (termToRational term) == term -- This is not sufficient - --it "has compatible encoding/decoding to/from PersistValue" . property $ + --it "has compatible encoding/decoding to/from PersistValue" . property $ -- \term -> fromPersistValue (toPersistValue term) == term it "has human readable year encoding to Rational" . property $ \term -> truncate (termToRational term) == year term