Skip to content

Commit

Permalink
CNS-1009: test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
oren-lava committed Oct 10, 2024
1 parent 1071628 commit e4c3af0
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions x/pairing/keeper/delegator_rewards_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ func TestDelegationTimestamp(t *testing.T) {
_, delegator := ts.GetAccount(common.CONSUMER, 1)

// delegate and check the timestamp is equal to current time + month
currentTimeAfterMonth := ts.GetNextMonth(ts.BlockTime())
currentTimeAfterMonth := ts.BlockTime().AddDate(0, 0, 7).UTC().Unix()
_, err := ts.TxDualstakingDelegate(delegator, provider, sdk.NewCoin(ts.TokenDenom(), sdk.NewInt(testStake)))

require.NoError(t, err)
Expand Down Expand Up @@ -490,8 +490,8 @@ func TestDelegationFirstMonthPairing(t *testing.T) {
ts.Keepers.Epochstorage.SetStakeEntryCurrent(ts.Ctx, stakeEntry)
ts.AdvanceEpoch()

// delegate and check the delegation's timestamp is equal than nowPlusMonthTime
nowPlusMonthTime := ts.GetNextMonth(ts.BlockTime())
// delegate and check the delegation's timestamp is equal than nowPlusWeekTime
nowPlusWeekTime := ts.BlockTime().AddDate(0, 0, 7).UTC().Unix()

_, err := ts.TxDualstakingDelegate(delegator, provider, sdk.NewCoin(ts.TokenDenom(), sdk.NewInt(testStake)))
require.NoError(t, err)
Expand All @@ -502,7 +502,7 @@ func TestDelegationFirstMonthPairing(t *testing.T) {
require.Equal(t, 2, len(res.Delegations)) // expect two because of provider self delegation + delegator
for _, d := range res.Delegations {
if d.Delegator == delegator {
require.Equal(t, nowPlusMonthTime, d.Timestamp)
require.Equal(t, nowPlusWeekTime, d.Timestamp)
}
}

Expand Down Expand Up @@ -532,8 +532,8 @@ func TestDelegationFirstMonthReward(t *testing.T) {
ts.AdvanceEpoch()
makeProviderCommissionZero(ts, provider)

// delegate and check the delegation's timestamp is equal to nowPlusMonthTime
nowPlusMonthTime := ts.GetNextMonth(ts.BlockTime())
// delegate and check the delegation's timestamp is equal to nowPlusWeekTime
nowPlusWeekTime := ts.BlockTime().AddDate(0, 0, 7).UTC().Unix()

_, err := ts.TxDualstakingDelegate(delegator, provider, sdk.NewCoin(ts.TokenDenom(), sdk.NewInt(testStake)))
require.NoError(t, err)
Expand All @@ -544,7 +544,7 @@ func TestDelegationFirstMonthReward(t *testing.T) {
require.Equal(t, 2, len(res.Delegations)) // expect two because of provider self delegation + delegator
for _, d := range res.Delegations {
if d.Delegator == delegator {
require.Equal(t, nowPlusMonthTime, d.Timestamp)
require.Equal(t, nowPlusWeekTime, d.Timestamp)
}
}

Expand Down Expand Up @@ -587,8 +587,8 @@ func TestRedelegationFirstMonthReward(t *testing.T) {
makeProviderCommissionZero(ts, provider1)
makeProviderCommissionZero(ts, provider)

// delegate and check the delegation's timestamp is equal to nowPlusMonthTime
nowPlusMonthTime := ts.GetNextMonth(ts.BlockTime())
// delegate and check the delegation's timestamp is equal to nowPlusWeekTime
nowPlusWeekTime := ts.BlockTime().AddDate(0, 0, 7).UTC().Unix()

_, err := ts.TxDualstakingDelegate(delegator, provider, sdk.NewCoin(ts.TokenDenom(), sdk.NewInt(testStake)))
require.NoError(t, err)
Expand All @@ -599,7 +599,7 @@ func TestRedelegationFirstMonthReward(t *testing.T) {
require.Equal(t, 2, len(res.Delegations)) // expect two because of provider self delegation + delegator
for _, d := range res.Delegations {
if d.Delegator == delegator {
require.Equal(t, nowPlusMonthTime, d.Timestamp)
require.Equal(t, nowPlusWeekTime, d.Timestamp)
}
}

Expand Down

0 comments on commit e4c3af0

Please sign in to comment.