Skip to content

Commit

Permalink
chore: add test for addpair
Browse files Browse the repository at this point in the history
  • Loading branch information
RafilxTenfen committed Dec 2, 2024
1 parent 447e988 commit 6d09184
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions x/btcstaking/keeper/params_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package keeper_test

import (
"fmt"
"math"
"math/rand"
"testing"
Expand All @@ -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()
Expand Down

0 comments on commit 6d09184

Please sign in to comment.