diff --git a/x/btcstaking/keeper/params_test.go b/x/btcstaking/keeper/params_test.go index 63aedfae..26300809 100644 --- a/x/btcstaking/keeper/params_test.go +++ b/x/btcstaking/keeper/params_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "fmt" "math" "math/rand" "testing" @@ -24,6 +25,22 @@ func TestGetParams(t *testing.T) { require.EqualValues(t, params, k.GetParams(ctx)) } +func TestAddNewPairParams(t *testing.T) { + htvm := types.NewHeightToVersionMap() + // btc start height, version of params + err := htvm.AddNewPair(10, 0) + require.NoError(t, err) + + err = htvm.AddNewPair(11, 1) + require.NoError(t, err) + + err = htvm.AddNewPair(11, 2) + require.EqualError(t, err, fmt.Errorf("pairs must be sorted by start height in ascending order, got %d <= %d", 11, 11).Error()) + + err = htvm.AddNewPair(15, 1) + require.EqualError(t, err, fmt.Errorf("versions must be strictly increasing, got %d != %d + 1", 1, 1).Error()) +} + func TestGetParamsVersions(t *testing.T) { k, ctx := testkeeper.BTCStakingKeeper(t, nil, nil, nil) params := types.DefaultParams()