Skip to content

Commit

Permalink
Add Unit Test to Check Host Zone Min/Max RR (#699)
Browse files Browse the repository at this point in the history
## Context and purpose of the change

We are missing a unit test that checks the Min/Max RRs are set properly when a host zone is created.
  • Loading branch information
shellvish authored Apr 6, 2023
1 parent edeffb3 commit 3a5c7bf
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions x/stakeibc/keeper/msg_server_register_host_zone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ func (s *KeeperTestSuite) SetupRegisterHostZone() RegisterHostZoneTestCase {
IbcDenom: IbcAtom,
TransferChannelId: ibctesting.FirstChannelID,
UnbondingFrequency: unbondingFrequency,
MinRedemptionRate: sdk.NewDec(0),
MaxRedemptionRate: sdk.NewDec(0),
}

return RegisterHostZoneTestCase{
Expand Down Expand Up @@ -120,6 +122,10 @@ func (s *KeeperTestSuite) TestRegisterHostZone_Success() {
s.Require().True(found, "host zone found")
s.Require().Equal(tc.defaultRedemptionRate, hostZone.RedemptionRate, "redemption rate set to default: 1")
s.Require().Equal(tc.defaultRedemptionRate, hostZone.LastRedemptionRate, "last redemption rate set to default: 1")
defaultMinThreshold := sdk.NewDec(int64(stakeibctypes.DefaultMinRedemptionRateThreshold)).Quo(sdk.NewDec(100))
defaultMaxThreshold := sdk.NewDec(int64(stakeibctypes.DefaultMaxRedemptionRateThreshold)).Quo(sdk.NewDec(100))
s.Require().Equal(defaultMinThreshold, hostZone.MinRedemptionRate, "min redemption rate set to default")
s.Require().Equal(defaultMaxThreshold, hostZone.MaxRedemptionRate, "max redemption rate set to default")
s.Require().Equal(tc.unbondingFrequency, hostZone.UnbondingFrequency, "unbonding frequency set to default: 3")

// Confirm host zone unbonding record was created
Expand Down

0 comments on commit 3a5c7bf

Please sign in to comment.