Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

Commit

Permalink
Merge branch 'feat/withdraw-sld-fee' into feat/pay-tld-registration-fee
Browse files Browse the repository at this point in the history
  • Loading branch information
taryune committed Oct 31, 2023
2 parents 4a191ae + c2c121b commit 9bce4d1
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions x/registry/keeper/msg_server_withdraw_registration_fee_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"

"github.com/mycel-domain/mycel/testutil"
"github.com/mycel-domain/mycel/x/registry/types"
Expand Down Expand Up @@ -54,7 +55,9 @@ func (suite *KeeperTestSuite) TestWithdrawRegistrationFee() {
// Before balance
withdrawerAddress, err := sdk.AccAddressFromBech32(tc.withdrawer)
suite.Require().Nil(err)
beforeBalance := suite.app.BankKeeper.GetAllBalances(suite.ctx, withdrawerAddress)
beforeWithdrawerBalance := suite.app.BankKeeper.GetAllBalances(suite.ctx, withdrawerAddress)
registryAddress := authtypes.NewModuleAddress(types.ModuleName)
beforeRegistryAddress := suite.app.BankKeeper.GetAllBalances(suite.ctx, registryAddress)

// Withdraw registration fee
withdrawMsg := &types.MsgWithdrawRegistrationFee{
Expand All @@ -75,8 +78,16 @@ func (suite *KeeperTestSuite) TestWithdrawRegistrationFee() {
}

// Check balance
afterBalance := suite.app.BankKeeper.GetAllBalances(suite.ctx, withdrawerAddress)
suite.Require().Equal(beforeBalance.Add(fees.RegistrationFee...), afterBalance)
afterWithdrawerBalance := suite.app.BankKeeper.GetAllBalances(suite.ctx, withdrawerAddress)
suite.Require().Equal(beforeWithdrawerBalance.Add(fees.RegistrationFee...), afterWithdrawerBalance)
afterRegistyAddress := suite.app.BankKeeper.GetAllBalances(suite.ctx, registryAddress)
suite.Require().Equal(beforeRegistryAddress.Sub(fees.RegistrationFee...), afterRegistyAddress)

// Check top level domain
topLevelDomain, found := suite.app.RegistryKeeper.GetTopLevelDomain(suite.ctx, tc.topLevelDomainName)
suite.Require().True(found)
suite.Require().True(topLevelDomain.RegistrationFee.IsEqual(sdk.NewCoins()))

} else {
suite.Require().EqualError(err, tc.expErr.Error())
}
Expand Down

0 comments on commit 9bce4d1

Please sign in to comment.