Skip to content

Commit

Permalink
extract duplicated code
Browse files Browse the repository at this point in the history
  • Loading branch information
tuantran1702 committed Apr 8, 2024
1 parent 9a81086 commit 619b3fa
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions x/feeabs/ante/ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ import (

func TestMempoolDecorator(t *testing.T) {
gasLimit := uint64(200000)
// mockHostZoneConfig is used to mock the host zone config, with ibcfee as the ibc fee denom to be used as alternative fee
mockHostZoneConfig := types.HostChainFeeAbsConfig{
IbcDenom: "ibcfee",
OsmosisPoolTokenDenomIn: "osmosis",
PoolId: 1,
Status: types.HostChainFeeAbsStatus_UPDATED,
MinSwapAmount: 0,
}
testCases := []struct {
name string
feeAmount sdk.Coins
Expand Down Expand Up @@ -61,13 +69,7 @@ func TestMempoolDecorator(t *testing.T) {
sdk.NewCoins(sdk.NewInt64Coin("ibcfee", 999*int64(gasLimit))),
sdk.NewDecCoinsFromCoins(sdk.NewCoins(sdk.NewInt64Coin("native", 1000))...),
func(suite *AnteTestSuite) {
err := suite.feeabsKeeper.SetHostZoneConfig(suite.ctx, types.HostChainFeeAbsConfig{
IbcDenom: "ibcfee",
OsmosisPoolTokenDenomIn: "osmosis",
PoolId: 1,
Status: types.HostChainFeeAbsStatus_UPDATED,
MinSwapAmount: 0,
})
err := suite.feeabsKeeper.SetHostZoneConfig(suite.ctx, mockHostZoneConfig)
require.NoError(t, err)
suite.feeabsKeeper.SetTwapRate(suite.ctx, "ibcfee", sdk.NewDec(1))
suite.stakingKeeper.EXPECT().BondDenom(gomock.Any()).Return("native").MinTimes(1)
Expand All @@ -81,13 +83,7 @@ func TestMempoolDecorator(t *testing.T) {
sdk.NewCoins(sdk.NewInt64Coin("ibcfee", 1000*int64(gasLimit))),
sdk.NewDecCoinsFromCoins(sdk.NewCoins(sdk.NewInt64Coin("native", 1000))...),
func(suite *AnteTestSuite) {
err := suite.feeabsKeeper.SetHostZoneConfig(suite.ctx, types.HostChainFeeAbsConfig{
IbcDenom: "ibcfee",
OsmosisPoolTokenDenomIn: "osmosis",
PoolId: 1,
Status: types.HostChainFeeAbsStatus_UPDATED,
MinSwapAmount: 0,
})
err := suite.feeabsKeeper.SetHostZoneConfig(suite.ctx, mockHostZoneConfig)
require.NoError(t, err)
suite.feeabsKeeper.SetTwapRate(suite.ctx, "ibcfee", sdk.NewDec(1))
suite.stakingKeeper.EXPECT().BondDenom(gomock.Any()).Return("native").MinTimes(1)
Expand Down

0 comments on commit 619b3fa

Please sign in to comment.