mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-23 23:05:18 +00:00
update cdp tests to use CheckBalance method
This commit is contained in:
parent
215241edd9
commit
e3aca06236
@ -3,8 +3,6 @@ package cdp_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/simapp"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
@ -25,7 +23,7 @@ func TestApp_CreateModifyDeleteCDP(t *testing.T) {
|
||||
)
|
||||
// check balance
|
||||
ctx := tApp.NewContext(false, abci.Header{})
|
||||
require.Equal(t, cs(c("xrp", 100)), tApp.GetAccountKeeper().GetAccount(ctx, testAddr).GetCoins())
|
||||
tApp.CheckBalance(t, ctx, testAddr, cs(c("xrp", 100)))
|
||||
|
||||
// setup cdp keeper
|
||||
keeper := tApp.GetCDPKeeper()
|
||||
@ -62,7 +60,7 @@ func TestApp_CreateModifyDeleteCDP(t *testing.T) {
|
||||
|
||||
// check balance
|
||||
ctx = tApp.NewContext(true, abci.Header{})
|
||||
require.Equal(t, cs(c("usdx", 5), c("xrp", 90)), tApp.GetAccountKeeper().GetAccount(ctx, testAddr).GetCoins())
|
||||
tApp.CheckBalance(t, ctx, testAddr, cs(c("usdx", 5), c("xrp", 90)))
|
||||
|
||||
// Modify CDP
|
||||
msgs = []sdk.Msg{cdp.NewMsgCreateOrModifyCDP(testAddr, "xrp", i(40), i(5))}
|
||||
@ -70,7 +68,7 @@ func TestApp_CreateModifyDeleteCDP(t *testing.T) {
|
||||
|
||||
// check balance
|
||||
ctx = tApp.NewContext(true, abci.Header{})
|
||||
require.Equal(t, cs(c("usdx", 10), c("xrp", 50)), tApp.GetAccountKeeper().GetAccount(ctx, testAddr).GetCoins())
|
||||
tApp.CheckBalance(t, ctx, testAddr, cs(c("usdx", 10), c("xrp", 50)))
|
||||
|
||||
// Delete CDP
|
||||
msgs = []sdk.Msg{cdp.NewMsgCreateOrModifyCDP(testAddr, "xrp", i(-50), i(-10))}
|
||||
@ -78,5 +76,5 @@ func TestApp_CreateModifyDeleteCDP(t *testing.T) {
|
||||
|
||||
// check balance
|
||||
ctx = tApp.NewContext(true, abci.Header{})
|
||||
require.Equal(t, cs(c("xrp", 100)), tApp.GetAccountKeeper().GetAccount(ctx, testAddr).GetCoins())
|
||||
tApp.CheckBalance(t, ctx, testAddr, cs(c("xrp", 100)))
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ func TestKeeper_ModifyCDP(t *testing.T) {
|
||||
require.Equal(t, tc.expectedState.GlobalDebt, actualGDebt)
|
||||
require.Equal(t, tc.expectedState.CollateralState, actualCstate)
|
||||
// check owner balance
|
||||
require.Equal(t, tc.expectedState.OwnerCoins, tApp.GetAccountKeeper().GetAccount(ctx, ownerAddr).GetCoins())
|
||||
tApp.CheckBalance(t, ctx, ownerAddr, tc.expectedState.OwnerCoins)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user