Skip to content

Commit

Permalink
add assertion mismatch message
Browse files Browse the repository at this point in the history
  • Loading branch information
pgoos committed Mar 4, 2024
1 parent 52880d3 commit 2d8cfe4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/eibc_fulfillment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func TestEIBCFulfillment(t *testing.T) {
balance, err := dymension.GetBalance(ctx, marketMakerAddr, rollappIBCDenom)
require.NoError(t, err)
fmt.Println("Balance of marketMakerAddr after preconditions:", balance)
require.True(t, balance.Equal(expMmBalanceRollappDenom))
require.True(t, balance.Equal(expMmBalanceRollappDenom), fmt.Sprintf("Value mismatch. Expected %s, actual %s", expMmBalanceRollappDenom, balance))
// end of preconditions

transferData = ibc.WalletData{
Expand All @@ -208,7 +208,7 @@ func TestEIBCFulfillment(t *testing.T) {
balance, err = dymension.GetBalance(ctx, dymensionUserAddr, rollappIBCDenom)
require.NoError(t, err)
fmt.Println("Balance of dymensionUserAddr right after sending eIBC transfer:", balance)
require.True(t, balance.Equal(zeroBalance))
require.True(t, balance.Equal(zeroBalance), fmt.Sprintf("Value mismatch. Expected %s, actual %s", zeroBalance, balance))

// get eIbc event
eibcEvents, err := getEIbcEventsWithinBlockRange(ctx, dymension, 30, false)
Expand All @@ -232,13 +232,13 @@ func TestEIBCFulfillment(t *testing.T) {
balance, err = dymension.GetBalance(ctx, dymensionUserAddr, rollappIBCDenom)
require.NoError(t, err)
fmt.Println("Balance of dymensionUserAddr after fulfilling the order:", balance)
require.True(t, balance.Equal(transferAmountWithoutFee))
require.True(t, balance.Equal(transferAmountWithoutFee), fmt.Sprintf("Value mismatch. Expected %s, actual %s", transferAmountWithoutFee, balance))
// verify funds were deducted from market maker's wallet address
balance, err = dymension.GetBalance(ctx, marketMakerAddr, rollappIBCDenom)
require.NoError(t, err)
fmt.Println("Balance of marketMakerAddr after fulfilling the order:", balance)
expMmBalanceRollappDenom = expMmBalanceRollappDenom.Sub((transferAmountWithoutFee))
require.True(t, balance.Equal(expMmBalanceRollappDenom))
require.True(t, balance.Equal(expMmBalanceRollappDenom), fmt.Sprintf("Value mismatch. Expected %s, actual %s", expMmBalanceRollappDenom, balance))
// wait until packet finalization and verify funds + fee were added to market maker's wallet address
// we've waited 30 blocks already so we don't have to now wait the entire BLOCK_FINALITY_PERIOD blocks
err = testutil.WaitForBlocks(ctx, BLOCK_FINALITY_PERIOD-30+5, dymension)
Expand All @@ -247,7 +247,7 @@ func TestEIBCFulfillment(t *testing.T) {
require.NoError(t, err)
fmt.Println("Balance of marketMakerAddr after packet finalization:", balance)
expMmBalanceRollappDenom = expMmBalanceRollappDenom.Add(transferData.Amount)
require.True(t, balance.Equal(expMmBalanceRollappDenom))
require.True(t, balance.Equal(expMmBalanceRollappDenom), fmt.Sprintf("Value mismatch. Expected %s, actual %s", expMmBalanceRollappDenom, balance))

t.Cleanup(
func() {
Expand Down

0 comments on commit 2d8cfe4

Please sign in to comment.