Skip to content

Commit

Permalink
add an extra integration test to show backward compatibility of the q…
Browse files Browse the repository at this point in the history
…uitstakepool
  • Loading branch information
KtorZ committed Feb 14, 2020
1 parent 8185ced commit b7f3626
Showing 1 changed file with 23 additions and 0 deletions.
Expand Up @@ -452,6 +452,29 @@ spec = do
, expectErrorMessage (errMsg403DelegationFee (feeQuit - 1))
]

it "STAKE_POOLS_QUIT_01x - \
\Backward compatibility with pool ids" $ \ctx -> do
w <- fixtureWallet ctx
(_, p1:p2:_) <- eventually $
unsafeRequest @[ApiStakePool] ctx Link.listStakePools Empty

-- Join a pool
joinStakePool ctx (p1 ^. #id) (w, fixturePassphrase) >>= flip verify
[ expectResponseCode HTTP.status202
, expectField (#status . #getApiT) (`shouldBe` Pending)
, expectField (#direction . #getApiT) (`shouldBe` Outgoing)
]

-- Quit delegation with an arbitrary id
-- NOTE: We use another id purposely, just to show that the id has no
-- influence but doesn't lead to an API error.
let pid = BackwardCompat (Identity (p2 ^. #id))
quitStakePool ctx pid (w, fixturePassphrase) >>= flip verify
[ expectResponseCode HTTP.status202
, expectField (#status . #getApiT) (`shouldBe` Pending)
, expectField (#direction . #getApiT) (`shouldBe` Outgoing)
]

it "STAKE_POOLS_JOIN_01 - I cannot rejoin the same stake-pool" $ \ctx -> do
let (fee, _) = ctx ^. #_feeEstimator $ DelegDescription 1 1 1
(w, p) <- joinStakePoolWithWalletBalance ctx [10*fee]
Expand Down

0 comments on commit b7f3626

Please sign in to comment.