Skip to content

Commit 9e862da

Browse files
committed
fix test
1 parent 98e1dd8 commit 9e862da

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

x/restake/keeper/keeper_lock_test.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111

1212
func (suite *KeeperTestSuite) TestSetLockedPower() {
1313
ctx := suite.ctx
14+
suite.setupState()
1415

1516
// error case - amount is not uint64
1617
err := suite.restakeKeeper.SetLockedPower(ctx, ValidAddress1, KeyWithRewards, sdkmath.NewInt(-5))
@@ -21,7 +22,7 @@ func (suite *KeeperTestSuite) TestSetLockedPower() {
2122
suite.Require().Error(err)
2223

2324
// error case - key is deactivated
24-
_, err = suite.restakeKeeper.GetLockedPower(ctx, ValidAddress2, InactiveKey)
25+
err = suite.restakeKeeper.SetLockedPower(ctx, ValidAddress1, InactiveKey, sdkmath.NewInt(10))
2526
suite.Require().Error(err)
2627

2728
// success cases
@@ -41,8 +42,8 @@ func (suite *KeeperTestSuite) TestSetLockedPower() {
4142
"success case - no previous lock with empty rewards",
4243
func() {
4344
preKey = types.Key{
44-
Name: KeyWithRewards,
45-
PoolAddress: KeyWithRewardsPoolAddress.String(),
45+
Name: KeyWithoutRewards,
46+
PoolAddress: KeyWithoutRewardsPoolAddress.String(),
4647
IsActive: true,
4748
RewardPerPowers: nil,
4849
TotalPower: sdkmath.NewInt(100),
@@ -56,7 +57,7 @@ func (suite *KeeperTestSuite) TestSetLockedPower() {
5657
sdkmath.NewInt(200),
5758
types.Lock{
5859
StakerAddress: ValidAddress1.String(),
59-
Key: KeyWithRewards,
60+
Key: KeyWithoutRewards,
6061
Amount: sdkmath.NewInt(100),
6162
PosRewardDebts: nil,
6263
NegRewardDebts: nil,
@@ -66,8 +67,8 @@ func (suite *KeeperTestSuite) TestSetLockedPower() {
6667
"success case - have previous lock with empty rewards",
6768
func() {
6869
preKey = types.Key{
69-
Name: KeyWithRewards,
70-
PoolAddress: KeyWithRewardsPoolAddress.String(),
70+
Name: KeyWithoutRewards,
71+
PoolAddress: KeyWithoutRewardsPoolAddress.String(),
7172
IsActive: true,
7273
RewardPerPowers: nil,
7374
TotalPower: sdkmath.NewInt(100),
@@ -76,7 +77,7 @@ func (suite *KeeperTestSuite) TestSetLockedPower() {
7677

7778
preLock = &types.Lock{
7879
StakerAddress: ValidAddress1.String(),
79-
Key: KeyWithRewards,
80+
Key: KeyWithoutRewards,
8081
Amount: sdkmath.NewInt(10),
8182
PosRewardDebts: nil,
8283
NegRewardDebts: nil,
@@ -87,7 +88,7 @@ func (suite *KeeperTestSuite) TestSetLockedPower() {
8788
sdkmath.NewInt(190),
8889
types.Lock{
8990
StakerAddress: ValidAddress1.String(),
90-
Key: KeyWithRewards,
91+
Key: KeyWithoutRewards,
9192
Amount: sdkmath.NewInt(100),
9293
PosRewardDebts: nil,
9394
NegRewardDebts: nil,

x/restake/types/msgs_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,17 @@ func TestMsgClaimRewards_GetSigners(t *testing.T) {
5757
func TestMsgClaimRewards_ValidateBasic(t *testing.T) {
5858
acc := sdk.MustAccAddressFromBech32(ValidAddress)
5959

60-
// Valid address
60+
// valid address
6161
msg := NewMsgClaimRewards(acc, ValidKey)
6262
err := msg.ValidateBasic()
6363
require.NoError(t, err)
6464

65-
// Invalid address
65+
// invalid address
6666
msg = NewMsgClaimRewards([]byte(InvalidAddress), ValidKey)
6767
err = msg.ValidateBasic()
6868
require.Error(t, err)
6969

70-
// Invalid key
70+
// invalid key
7171
msg = NewMsgClaimRewards(acc, InvalidKey)
7272
err = msg.ValidateBasic()
7373
require.Error(t, err)

0 commit comments

Comments
 (0)