package keeper_test
import (
"reflect"
"github.com/cerc-io/laconicd/x/evm/types"
)
func (suite *KeeperTestSuite) TestParams() {
params := suite.app.EvmKeeper.GetParams(suite.ctx)
suite.app.EvmKeeper.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.EvmKeeper.GetParams(suite.ctx)
true,
"success - EvmDenom param is set to \"inj\" and can be retrieved correctly",
params.EvmDenom = "inj"
return params.EvmDenom
return suite.app.EvmKeeper.GetEVMDenom(suite.ctx)
"success - Check EnableCreate param is set to false and can be retrieved correctly",
params.EnableCreate = false
return params.EnableCreate
return suite.app.EvmKeeper.GetEnableCreate(suite.ctx)
"success - Check EnableCall param is set to false and can be retrieved correctly",
params.EnableCall = false
return params.EnableCall
return suite.app.EvmKeeper.GetEnableCall(suite.ctx)
"success - Check AllowUnprotectedTxs param is set to false and can be retrieved correctly",
params.AllowUnprotectedTxs = false
return params.AllowUnprotectedTxs
return suite.app.EvmKeeper.GetAllowUnprotectedTxs(suite.ctx)
"success - Check ChainConfig param is set to the default value and can be retrieved correctly",
params.ChainConfig = types.DefaultChainConfig()
return params.ChainConfig
return suite.app.EvmKeeper.GetChainConfig(suite.ctx)
}
for _, tc := range testCases {
suite.Run(tc.name, func() {
outcome := reflect.DeepEqual(tc.paramsFun(), tc.getFun())
suite.Require().Equal(tc.expected, outcome)
})