Skip to content

Commit

Permalink
Add test for updating minimum power in top N
Browse files Browse the repository at this point in the history
  • Loading branch information
p-offtermatt committed Jun 12, 2024
1 parent 4784943 commit a0528ae
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions x/ccv/provider/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -852,3 +852,22 @@ func TestMinimumPowerInTopN(t *testing.T) {
require.False(t, found)
require.Equal(t, int64(0), nonExistentMinPower)
}

func TestUpdateMinimumPowerInTopN(t *testing.T) {
k, ctx, _, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t))

chainID := "testChain"
initialMinPower := int64(1000)
updatedMinPower := int64(2000)

// Set the initial minimum power in top N
k.SetMinimumPowerInTopN(ctx, chainID, initialMinPower)

// Update the minimum power in top N
k.SetMinimumPowerInTopN(ctx, chainID, updatedMinPower)

// Retrieve the updated minimum power in top N
gotMinPower, found := k.GetMinimumPowerInTopN(ctx, chainID)
require.True(t, found)
require.Equal(t, updatedMinPower, gotMinPower)
}

0 comments on commit a0528ae

Please sign in to comment.