chore(test): fix lint and refactor test (#20213)
This commit is contained in:
parent
8a36d9d3d0
commit
128bb968b2
@ -346,8 +346,7 @@ func TestStore_Save(t *testing.T) {
|
||||
assert.Equal(t, []uint64{7, 7}, gotErrHeights)
|
||||
}
|
||||
|
||||
type ReadCloserMock struct {
|
||||
}
|
||||
type ReadCloserMock struct{}
|
||||
|
||||
func (r ReadCloserMock) Read(p []byte) (n int, err error) {
|
||||
return len(p), io.EOF
|
||||
|
||||
@ -131,7 +131,7 @@ func (s *E2ETestSuite) TestContinuousLockingAccount() {
|
||||
require.NotNil(t, del)
|
||||
|
||||
// check if tracking is updated accordingly
|
||||
lockupAccountInfoResponse := s.queryLockupAccInfo(t, ctx, app, accountAddr)
|
||||
lockupAccountInfoResponse := s.queryLockupAccInfo(ctx, app, accountAddr)
|
||||
delLocking := lockupAccountInfoResponse.DelegatedLocking
|
||||
require.True(t, delLocking.AmountOf("stake").Equal(math.NewInt(100)))
|
||||
})
|
||||
@ -164,7 +164,7 @@ func (s *E2ETestSuite) TestContinuousLockingAccount() {
|
||||
require.Equal(t, len(ubd.Entries), 1)
|
||||
|
||||
// check if tracking is updated accordingly
|
||||
lockupAccountInfoResponse := s.queryLockupAccInfo(t, ctx, app, accountAddr)
|
||||
lockupAccountInfoResponse := s.queryLockupAccInfo(ctx, app, accountAddr)
|
||||
delLocking := lockupAccountInfoResponse.DelegatedLocking
|
||||
require.True(t, delLocking.AmountOf("stake").Equal(math.ZeroInt()))
|
||||
})
|
||||
@ -194,7 +194,7 @@ func (s *E2ETestSuite) TestContinuousLockingAccount() {
|
||||
require.NotNil(t, del)
|
||||
|
||||
// check if tracking is updated accordingly
|
||||
lockupAccountInfoResponse := s.queryLockupAccInfo(t, ctx, app, accountAddr)
|
||||
lockupAccountInfoResponse := s.queryLockupAccInfo(ctx, app, accountAddr)
|
||||
delLocking := lockupAccountInfoResponse.DelegatedLocking
|
||||
require.True(t, delLocking.AmountOf("stake").Equal(math.ZeroInt()))
|
||||
delFree := lockupAccountInfoResponse.DelegatedFree
|
||||
|
||||
@ -93,7 +93,7 @@ func (s *E2ETestSuite) TestDelayedLockingAccount() {
|
||||
require.NotNil(t, del)
|
||||
|
||||
// check if tracking is updated accordingly
|
||||
lockupAccountInfoResponse := s.queryLockupAccInfo(t, ctx, app, accountAddr)
|
||||
lockupAccountInfoResponse := s.queryLockupAccInfo(ctx, app, accountAddr)
|
||||
delLocking := lockupAccountInfoResponse.DelegatedLocking
|
||||
require.True(t, delLocking.AmountOf("stake").Equal(math.NewInt(100)))
|
||||
})
|
||||
@ -126,7 +126,7 @@ func (s *E2ETestSuite) TestDelayedLockingAccount() {
|
||||
require.Equal(t, len(ubd.Entries), 1)
|
||||
|
||||
// check if tracking is updated accordingly
|
||||
lockupAccountInfoResponse := s.queryLockupAccInfo(t, ctx, app, accountAddr)
|
||||
lockupAccountInfoResponse := s.queryLockupAccInfo(ctx, app, accountAddr)
|
||||
delLocking := lockupAccountInfoResponse.DelegatedLocking
|
||||
require.True(t, delLocking.AmountOf("stake").Equal(math.ZeroInt()))
|
||||
})
|
||||
|
||||
@ -37,7 +37,8 @@ func (s *E2ETestSuite) TestPeriodicLockingAccount() {
|
||||
{
|
||||
Amount: sdk.NewCoins(sdk.NewCoin("stake", math.NewInt(500))),
|
||||
Length: time.Minute,
|
||||
}, {
|
||||
},
|
||||
{
|
||||
Amount: sdk.NewCoins(sdk.NewCoin("stake", math.NewInt(500))),
|
||||
Length: time.Minute,
|
||||
},
|
||||
@ -153,7 +154,7 @@ func (s *E2ETestSuite) TestPeriodicLockingAccount() {
|
||||
require.NotNil(t, del)
|
||||
|
||||
// check if tracking is updated accordingly
|
||||
lockupAccountInfoResponse := s.queryLockupAccInfo(t, ctx, app, accountAddr)
|
||||
lockupAccountInfoResponse := s.queryLockupAccInfo(ctx, app, accountAddr)
|
||||
fmt.Println(lockupAccountInfoResponse)
|
||||
delLocking := lockupAccountInfoResponse.DelegatedLocking
|
||||
require.True(t, delLocking.AmountOf("stake").Equal(math.NewInt(100)))
|
||||
@ -187,7 +188,7 @@ func (s *E2ETestSuite) TestPeriodicLockingAccount() {
|
||||
require.Equal(t, len(ubd.Entries), 1)
|
||||
|
||||
// check if tracking is updated accordingly
|
||||
lockupAccountInfoResponse := s.queryLockupAccInfo(t, ctx, app, accountAddr)
|
||||
lockupAccountInfoResponse := s.queryLockupAccInfo(ctx, app, accountAddr)
|
||||
delLocking := lockupAccountInfoResponse.DelegatedLocking
|
||||
require.True(t, delLocking.AmountOf("stake").Equal(math.ZeroInt()))
|
||||
})
|
||||
@ -217,7 +218,7 @@ func (s *E2ETestSuite) TestPeriodicLockingAccount() {
|
||||
require.NotNil(t, del)
|
||||
|
||||
// check if tracking is updated accordingly
|
||||
lockupAccountInfoResponse := s.queryLockupAccInfo(t, ctx, app, accountAddr)
|
||||
lockupAccountInfoResponse := s.queryLockupAccInfo(ctx, app, accountAddr)
|
||||
delFree := lockupAccountInfoResponse.DelegatedFree
|
||||
require.True(t, delFree.AmountOf("stake").Equal(math.NewInt(100)))
|
||||
})
|
||||
|
||||
@ -77,7 +77,7 @@ func (s *E2ETestSuite) TestPermanentLockingAccount() {
|
||||
require.NotNil(t, del)
|
||||
|
||||
// check if tracking is updated accordingly
|
||||
lockupAccountInfoResponse := s.queryLockupAccInfo(t, ctx, app, accountAddr)
|
||||
lockupAccountInfoResponse := s.queryLockupAccInfo(ctx, app, accountAddr)
|
||||
delLocking := lockupAccountInfoResponse.DelegatedLocking
|
||||
require.True(t, delLocking.AmountOf("stake").Equal(math.NewInt(100)))
|
||||
})
|
||||
@ -110,7 +110,7 @@ func (s *E2ETestSuite) TestPermanentLockingAccount() {
|
||||
require.Equal(t, len(ubd.Entries), 1)
|
||||
|
||||
// check if tracking is updated accordingly
|
||||
lockupAccountInfoResponse := s.queryLockupAccInfo(t, ctx, app, accountAddr)
|
||||
lockupAccountInfoResponse := s.queryLockupAccInfo(ctx, app, accountAddr)
|
||||
delLocking := lockupAccountInfoResponse.DelegatedLocking
|
||||
require.True(t, delLocking.AmountOf("stake").Equal(math.ZeroInt()))
|
||||
})
|
||||
|
||||
@ -61,14 +61,14 @@ func (s *E2ETestSuite) fundAccount(app *simapp.SimApp, ctx sdk.Context, addr sdk
|
||||
require.NoError(s.T(), testutil.FundAccount(ctx, app.BankKeeper, addr, amt))
|
||||
}
|
||||
|
||||
func (s *E2ETestSuite) queryLockupAccInfo(t *testing.T, ctx sdk.Context, app *simapp.SimApp, accAddr []byte) *types.QueryLockupAccountInfoResponse {
|
||||
func (s *E2ETestSuite) queryLockupAccInfo(ctx sdk.Context, app *simapp.SimApp, accAddr []byte) *types.QueryLockupAccountInfoResponse {
|
||||
req := &types.QueryLockupAccountInfoRequest{}
|
||||
resp, err := s.queryAcc(ctx, req, app, accAddr)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, resp)
|
||||
require.NoError(s.T(), err)
|
||||
require.NotNil(s.T(), resp)
|
||||
|
||||
lockupAccountInfoResponse, ok := resp.(*types.QueryLockupAccountInfoResponse)
|
||||
require.True(t, ok)
|
||||
require.True(s.T(), ok)
|
||||
|
||||
return lockupAccountInfoResponse
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user