package keeper_test
import (
"reflect"
"github.com/evmos/ethermint/x/feemarket/types"
)
func (suite *KeeperTestSuite) TestSetGetParams() {
params := suite.app.FeeMarketKeeper.GetParams(suite.ctx)
suite.app.FeeMarketKeeper.SetParams(suite.ctx, params)
testCases := []struct {
name string
paramsFun func() interface{}
getFun func() interface{}
expected bool
}{
{
"success - Checks if the default params are set correctly",
func() interface{} {
return types.DefaultParams()
},
return suite.app.FeeMarketKeeper.GetParams(suite.ctx)
true,
"success - Check ElasticityMultiplier is set to 3 and can be retrieved correctly",
params.ElasticityMultiplier = 3
return params.ElasticityMultiplier
return suite.app.FeeMarketKeeper.GetParams(suite.ctx).ElasticityMultiplier
"success - Check BaseFeeEnabled is computed with its default params and can be retrieved correctly",
suite.app.FeeMarketKeeper.SetParams(suite.ctx, types.DefaultParams())
return true
return suite.app.FeeMarketKeeper.GetBaseFeeEnabled(suite.ctx)
"success - Check BaseFeeEnabled is computed with alternate params and can be retrieved correctly",
params.NoBaseFee = true
params.EnableHeight = 5
false,
}
for _, tc := range testCases {
suite.Run(tc.name, func() {
outcome := reflect.DeepEqual(tc.paramsFun(), tc.getFun())
suite.Require().Equal(tc.expected, outcome)
})