Skip to content

Commit

Permalink
simplify test
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaslopezf committed Oct 22, 2024
1 parent 73d13f6 commit 49641b7
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions tests/systemtests/account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,12 @@ func TestAccountsMigration(t *testing.T) {
sut.ResetChain(t)
cli := NewCLIWrapper(t, sut, verbose)

// Create legacy-account with some tokens
legacyName := "legacy-account"
legacyAddress := cli.AddKey(legacyName)
require.NotEmpty(t, legacyAddress)

legacyAddress := cli.GetKeyAddr(defaultSrcAddr)
// Create a receiver account
receiverName := "receiver-account"
receiverAddress := cli.AddKey(receiverName)
require.NotEmpty(t, receiverAddress)

sut.ModifyGenesisCLI(t,
[]string{"genesis", "add-genesis-account", legacyAddress, "20000000stake"},
[]string{"genesis", "add-genesis-account", receiverAddress, "1000000stake"},
)

Expand Down Expand Up @@ -117,7 +111,7 @@ func TestAccountsMigration(t *testing.T) {
// Check initial balances
legacyBalance := cli.QueryBalance(legacyAddress, "stake")
receiverBalance := cli.QueryBalance(receiverAddress, "stake")
require.Equal(t, int64(19999999), legacyBalance) // 20000000 - 1 (fee for migration)
require.Equal(t, int64(399999999), legacyBalance) // 20000000 - 1 (fee for migration)
require.Equal(t, int64(1000000), receiverBalance)

transferAmount := "1000000"
Expand All @@ -133,8 +127,8 @@ func TestAccountsMigration(t *testing.T) {
newLegacyBalance := cli.QueryBalance(legacyAddress, "stake")
newReceiverBalance := cli.QueryBalance(receiverAddress, "stake")

expectedLegacyBalance := int64(19999999 - 1000000 - 1) // Initial balance - transferred amount - fee
expectedReceiverBalance := int64(1000000 + 1000000) // Initial balance + transferred amount
expectedLegacyBalance := legacyBalance - 1000000 - 1 // Initial balance - transferred amount - fee
expectedReceiverBalance := receiverBalance + 1000000 // Initial balance + transferred amount

require.Equal(t, expectedLegacyBalance, newLegacyBalance, "Legacy account balance is incorrect after transfer")
require.Equal(t, expectedReceiverBalance, newReceiverBalance, "Receiver account balance is incorrect after transfer")
Expand Down

0 comments on commit 49641b7

Please sign in to comment.