Skip to content

Commit bb6c319

Browse files
Generate possibly-empty lists of outputs in Arbitrary ApiTransaction.
1 parent ed61124 commit bb6c319

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

lib/core/test/unit/Cardano/Wallet/Api/TypesSpec.hs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,6 @@ import Data.FileEmbed
197197
( embedFile, makeRelativeToProject )
198198
import Data.Function
199199
( (&) )
200-
import Data.Generics.Internal.VL.Lens
201-
( view )
202200
import Data.List
203201
( foldl' )
204202
import Data.List.NonEmpty
@@ -1462,10 +1460,7 @@ instance Arbitrary ApiTxMetadata where
14621460
shrink = genericShrink
14631461

14641462
instance Arbitrary (ApiTransaction t) where
1465-
shrink = filter outputsNonEmpty . genericShrink
1466-
where
1467-
outputsNonEmpty :: ApiTransaction t -> Bool
1468-
outputsNonEmpty = (not . null) . view #outputs
1463+
shrink = genericShrink
14691464
arbitrary = do
14701465
txStatus <- arbitrary
14711466
txInsertedAt <- case txStatus of
@@ -1497,15 +1492,8 @@ instance Arbitrary (ApiTransaction t) where
14971492
where
14981493
genInputs =
14991494
Test.QuickCheck.scale (`mod` 3) arbitrary
1500-
-- Note that the generated list of outputs must be non-empty in order
1501-
-- to be consistent with the specification.
1502-
--
1503-
-- Ideally, we should encode this restriction in the type system.
1504-
--
1505-
-- See https://jira.iohk.io/browse/ADP-400.
1506-
genOutputs = (:)
1507-
<$> arbitrary
1508-
<*> Test.QuickCheck.scale (`mod` 3) arbitrary
1495+
genOutputs =
1496+
Test.QuickCheck.scale (`mod` 3) arbitrary
15091497
genWithdrawals =
15101498
Test.QuickCheck.scale (`mod` 3) arbitrary
15111499

0 commit comments

Comments
 (0)