Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rvl committed Oct 1, 2020
1 parent c764172 commit aef0bdc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import Cardano.Wallet.Api.Types
, WalletStyle (..)
, insertedAt
, pendingSince
, time
)
import Cardano.Wallet.Primitive.AddressDerivation
( PaymentAddress )
Expand All @@ -45,7 +44,7 @@ import Cardano.Wallet.Primitive.AddressDerivation.Icarus
import Cardano.Wallet.Primitive.Types
( Direction (..)
, Hash (..)
, SlotNo (..)
, SlotNo (SlotNo)
, SortOrder (..)
, TxMetadata (..)
, TxMetadataValue (..)
Expand Down
23 changes: 14 additions & 9 deletions lib/core/test/unit/Cardano/Wallet/Api/TypesSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import Cardano.Wallet.Api.Types
, ApiPutAddressesData (..)
, ApiRelativeAddressIndex (..)
, ApiSelectCoinsData (..)
, ApiSlotReference (..)
, ApiStakePool (..)
, ApiStakePoolMetrics (..)
, ApiT (..)
Expand Down Expand Up @@ -316,6 +317,7 @@ spec = do
jsonRoundtripAndGolden $ Proxy @ApiTimeReference
jsonRoundtripAndGolden $ Proxy @ApiNetworkTip
jsonRoundtripAndGolden $ Proxy @ApiBlockReference
jsonRoundtripAndGolden $ Proxy @ApiSlotReference
jsonRoundtripAndGolden $ Proxy @ApiNetworkInformation
jsonRoundtripAndGolden $ Proxy @ApiNetworkParameters
jsonRoundtripAndGolden $ Proxy @ApiNetworkClock
Expand Down Expand Up @@ -1242,8 +1244,8 @@ instance Arbitrary ApiBlockReference where
shrink = genericShrink

instance Arbitrary ApiSlotReference where
arbitrary = genericArbitrary
shrink = genericShrink
arbitrary = ApiSlotReference <$> genUniformTime <*> arbitrary
shrink (ApiSlotReference t sl) = ApiSlotReference t <$> shrink sl

instance Arbitrary ApiNetworkTip where
arbitrary = genericArbitrary
Expand Down Expand Up @@ -1367,14 +1369,17 @@ instance Arbitrary (ApiTransaction t) where
arbitrary = do
txStatus <- arbitrary
txInsertedAt <- case txStatus of
(ApiT Pending) -> pure Nothing
(ApiT InLedger) -> arbitrary
(ApiT Expired) -> pure Nothing
ApiT Pending -> pure Nothing
ApiT InLedger -> arbitrary
ApiT Expired -> pure Nothing
txPendingSince <- case txStatus of
(ApiT Pending) -> arbitrary
(ApiT InLedger) -> pure Nothing
(ApiT Expired) -> arbitrary
let txExpiresAt = txInsertedAt
ApiT Pending -> arbitrary
ApiT InLedger -> pure Nothing
ApiT Expired -> arbitrary
txExpiresAt <- case txStatus of
ApiT Pending -> arbitrary
ApiT InLedger -> pure Nothing
ApiT Expired -> Just <$> arbitrary

ApiTransaction
<$> arbitrary
Expand Down

0 comments on commit aef0bdc

Please sign in to comment.