mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-27 16:55:21 +00:00
40 lines
1.0 KiB
Go
40 lines
1.0 KiB
Go
|
package keeper_test
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/kava-labs/kava/app"
|
||
|
"github.com/kava-labs/kava/x/swap/types"
|
||
|
|
||
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
abci "github.com/tendermint/tendermint/abci/types"
|
||
|
tmtime "github.com/tendermint/tendermint/types/time"
|
||
|
)
|
||
|
|
||
|
func TestParams_SetterAndGetter(t *testing.T) {
|
||
|
tApp := app.NewTestApp()
|
||
|
keeper := tApp.GetSwapKeeper()
|
||
|
|
||
|
ctx := tApp.NewContext(true, abci.Header{Height: 1, Time: tmtime.Now()})
|
||
|
params := types.Params{
|
||
|
AllowedPools: types.AllowedPools{
|
||
|
types.NewAllowedPool("ukava", "usdx"),
|
||
|
},
|
||
|
SwapFee: sdk.MustNewDecFromStr("0.03"),
|
||
|
}
|
||
|
keeper.SetParams(ctx, params)
|
||
|
assert.Equal(t, keeper.GetParams(ctx), params)
|
||
|
|
||
|
oldParams := params
|
||
|
params = types.Params{
|
||
|
AllowedPools: types.AllowedPools{
|
||
|
types.NewAllowedPool("hard", "ukava"),
|
||
|
},
|
||
|
SwapFee: sdk.MustNewDecFromStr("0.01"),
|
||
|
}
|
||
|
keeper.SetParams(ctx, params)
|
||
|
assert.NotEqual(t, keeper.GetParams(ctx), oldParams)
|
||
|
assert.Equal(t, keeper.GetParams(ctx), params)
|
||
|
}
|