Skip to content

Commit

Permalink
test(gov): add missing assertion on TestTally
Browse files Browse the repository at this point in the history
Assert that votes are removed once tallyed.
  • Loading branch information
tbruyelle committed Jul 28, 2023
1 parent f0c852f commit 02f8f4d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions x/gov/keeper/tally_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"cosmossdk.io/collections"
sdkmath "cosmossdk.io/math"

"github.com/cosmos/cosmos-sdk/codec/address"
Expand Down Expand Up @@ -414,6 +415,10 @@ func TestTally(t *testing.T) {
assert.Equal(t, tt.expectedPass, pass, "wrong pass")
assert.Equal(t, tt.expectedBurn, burn, "wrong burn")
assert.Equal(t, tt.expectedTally, tally)
// Assert votes removal after tally
rng := collections.NewPrefixedPairRange[uint64, sdk.AccAddress](proposal.Id)
_, err = suite.keeper.Votes.Iterate(suite.ctx, rng)
assert.ErrorIs(t, err, collections.ErrInvalidIterator, "votes must be removed after tally")
})
}
}

0 comments on commit 02f8f4d

Please sign in to comment.