From 53539cb8c903f98cd470a02329582ea29e1355b5 Mon Sep 17 00:00:00 2001 From: Thomas Bruyelle Date: Fri, 28 Jul 2023 17:15:25 +0200 Subject: [PATCH] test(gov): add missing assertion on TestTally Assert that votes are removed once tallyed. --- x/gov/keeper/tally_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/x/gov/keeper/tally_test.go b/x/gov/keeper/tally_test.go index 6708b84d65bf..bae984b75f7a 100644 --- a/x/gov/keeper/tally_test.go +++ b/x/gov/keeper/tally_test.go @@ -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" @@ -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") }) } }