Skip to content

Commit

Permalink
Fixup: adjust tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Anviking committed Jun 18, 2020
1 parent 3cb753f commit 9042f06
Showing 1 changed file with 36 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import Cardano.Wallet.Primitive.AddressDerivation.Shelley
( ShelleyKey )
import Cardano.Wallet.Primitive.Types
( Coin (..), Direction (..), PoolId (..), TxStatus (..) )
import Cardano.Wallet.Unsafe
( unsafeMkPercentage )
import Data.Generics.Internal.VL.Lens
( view, (^.) )
import Data.Quantity
Expand Down Expand Up @@ -417,12 +419,12 @@ spec = do
]

it "STAKE_POOLS_LIST_01 - List stake pools" $ \ctx -> do
eventually "Listing stake pools shows expected information" $ do
r <- request @[ApiStakePool] ctx
(Link.listStakePools arbitraryStake) Default Empty
expectResponseCode HTTP.status200 r
verify r
[ expectListSize 3
_w <- fixtureWallet ctx -- Ambiguous type error without this line
r <- request @[ApiStakePool] ctx
(Link.listStakePools arbitraryStake) Default Empty
expectResponseCode HTTP.status200 r
verify r
[ expectListSize 3

-- Pending a mock metadata registry
-- , expectListField 0
Expand All @@ -432,22 +434,35 @@ spec = do
-- , expectListField 2
-- #metadata ((`shouldBe` Just "Genesis Pool") . fmap (view #name . getApiT))

, expectListField 0
#cost (`shouldBe` (Quantity 0))
, expectListField 1
#cost (`shouldBe` (Quantity 0))
, expectListField 2
#cost (`shouldBe` (Quantity 0))
, expectListField 0
(#cost) (.>= Just (Quantity 0))
, expectListField 1
(#cost) (.>= Just (Quantity 0))
, expectListField 2
(#cost) (.>= Just (Quantity 0))

, expectListField 0
#margin (`shouldBe` (Quantity minBound))
, expectListField 1
#margin (`shouldBe` (Quantity minBound))
, expectListField 2
#margin (`shouldBe` (Quantity minBound))
, expectListField 0
#margin (`shouldBe` Just (Quantity $ unsafeMkPercentage 0.1 ))
, expectListField 1
#margin (`shouldBe` Just (Quantity $ unsafeMkPercentage 0.1 ))
, expectListField 2
#margin (`shouldBe` Just (Quantity $ unsafeMkPercentage 0.1 ))

, expectListField 0
(#metrics . #saturation) (.>= 0)
, expectListField 1
(#metrics . #saturation) (.>= 0)
, expectListField 2
(#metrics . #saturation) (.>= 0)

-- Pending stake pools producing blocks in our setup,
-- AND pending keeping track of block producions
]
eventually "pools start producing blocks" $ do
request @[ApiStakePool] ctx
(Link.listStakePools arbitraryStake) Default Empty
>>= flip verify
-- Pending stake pools producing blocks in our setup,
-- AND pending keeping track of block producions
[ expectListSize 3
, expectListField 0
(#metrics . #producedBlocks) (.>= Quantity 0)
, expectListField 1
Expand All @@ -461,15 +476,9 @@ spec = do
(#metrics . #nonMyopicMemberRewards) (.>= Quantity 0)
, expectListField 2
(#metrics . #nonMyopicMemberRewards) (.>= Quantity 0)

, expectListField 0
(#metrics . #saturation) (.>= 0)
, expectListField 1
(#metrics . #saturation) (.>= 0)
, expectListField 2
(#metrics . #saturation) (.>= 0)
]


it "STAKE_POOLS_LIST_05 - Fails without query parameter" $ \ctx -> do
_w <- fixtureWallet ctx -- Ambiguous type error without this line
r <- request @[ApiStakePool] ctx
Expand Down

0 comments on commit 9042f06

Please sign in to comment.