2018-06-26 19:00:12 -07:00
|
|
|
package keeper
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2018-06-29 18:10:15 -07:00
|
|
|
"github.com/stretchr/testify/require"
|
2018-06-26 19:00:12 -07:00
|
|
|
|
2018-07-13 13:46:14 -07:00
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
2018-06-26 19:00:12 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/stake/types"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestParams(t *testing.T) {
|
|
|
|
ctx, _, keeper := CreateTestInput(t, false, 0)
|
|
|
|
expParams := types.DefaultParams()
|
|
|
|
|
|
|
|
//check that the empty keeper loads the default
|
|
|
|
resParams := keeper.GetParams(ctx)
|
2018-06-29 18:10:15 -07:00
|
|
|
require.True(t, expParams.Equal(resParams))
|
2018-06-26 19:00:12 -07:00
|
|
|
|
|
|
|
//modify a params, save, and retrieve
|
|
|
|
expParams.MaxValidators = 777
|
|
|
|
keeper.SetParams(ctx, expParams)
|
|
|
|
resParams = keeper.GetParams(ctx)
|
2018-06-29 18:10:15 -07:00
|
|
|
require.True(t, expParams.Equal(resParams))
|
2018-06-26 19:00:12 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestPool(t *testing.T) {
|
|
|
|
ctx, _, keeper := CreateTestInput(t, false, 0)
|
|
|
|
expPool := types.InitialPool()
|
|
|
|
|
|
|
|
//check that the empty keeper loads the default
|
|
|
|
resPool := keeper.GetPool(ctx)
|
2018-06-29 18:10:15 -07:00
|
|
|
require.True(t, expPool.Equal(resPool))
|
2018-06-26 19:00:12 -07:00
|
|
|
|
|
|
|
//modify a params, save, and retrieve
|
2019-01-02 12:29:47 -08:00
|
|
|
expPool.BondedTokens = sdk.NewInt(777)
|
2018-06-26 19:00:12 -07:00
|
|
|
keeper.SetPool(ctx, expPool)
|
|
|
|
resPool = keeper.GetPool(ctx)
|
2018-06-29 18:10:15 -07:00
|
|
|
require.True(t, expPool.Equal(resPool))
|
2018-06-26 19:00:12 -07:00
|
|
|
}
|