Skip to content

Commit

Permalink
Merge pull request #218 from hallazzang/hallazzang/fix-invariant-check-1
Browse files Browse the repository at this point in the history
  • Loading branch information
hallazzang authored Nov 9, 2021
2 parents acfe280 + 92869d2 commit f137b35
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions x/farming/keeper/invariants_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,22 @@ func (suite *KeeperTestSuite) TestNonNegativeHistoricalRewardsInvariant() {
}

func (suite *KeeperTestSuite) TestPositiveTotalStakingsAmountInvariant() {
k, ctx := suite.keeper, suite.ctx

// This is normal.
k.SetTotalStakings(ctx, denom1, types.TotalStakings{Amount: sdk.NewInt(1000000)})
_, broken := farmingkeeper.PositiveTotalStakingsAmountInvariant(k)(ctx)
suite.Require().False(broken)

// Zero-amount total stakings.
k.SetTotalStakings(ctx, denom1, types.TotalStakings{Amount: sdk.ZeroInt()})
_, broken = farmingkeeper.PositiveTotalStakingsAmountInvariant(k)(ctx)
suite.Require().True(broken)

// Negative-amount total stakings.
k.SetTotalStakings(ctx, denom1, types.TotalStakings{Amount: sdk.NewInt(-1)})
_, broken = farmingkeeper.PositiveTotalStakingsAmountInvariant(k)(ctx)
suite.Require().True(broken)
}

func (suite *KeeperTestSuite) TestPlanTerminationStatusInvariant() {
Expand Down

0 comments on commit f137b35

Please sign in to comment.