fix: update vesting tests to use fixed block time (#1838)

* fix: update SWP circulating supply test constant

* use fixed blocktime for vesting tests
This commit is contained in:
Robert Pirtle 2024-02-29 12:09:07 -08:00 committed by GitHub
parent 1d944d5219
commit 069be95dde
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,7 +7,6 @@ import (
sdkmath "cosmossdk.io/math" sdkmath "cosmossdk.io/math"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
tmtime "github.com/cometbft/cometbft/types/time"
"github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/baseapp"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
@ -38,12 +37,13 @@ func (m *mockBankKeeper) GetSupply(ctx sdk.Context, denom string) sdk.Coin {
} }
func (suite *grpcQueryTestSuite) SetupTest() { func (suite *grpcQueryTestSuite) SetupTest() {
testTime := time.Date(2024, 2, 29, 12, 00, 00, 00, time.UTC)
tApp := app.NewTestApp() tApp := app.NewTestApp()
ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: testTime})
suite.app = tApp suite.app = tApp
suite.ctx = ctx suite.ctx = ctx
suite.bk = &mockBankKeeper{} suite.bk = &mockBankKeeper{}
suite.queryClient = suite.queryClientWithBlockTime(tmtime.Now()) suite.queryClient = suite.queryClientWithBlockTime(testTime)
} }
func TestGrpcQueryTestSuite(t *testing.T) { func TestGrpcQueryTestSuite(t *testing.T) {
@ -89,9 +89,9 @@ func (suite *grpcQueryTestSuite) TestCirculatingSupplyUSDX() {
} }
func (suite *grpcQueryTestSuite) TestCirculatingSupplySWP() { func (suite *grpcQueryTestSuite) TestCirculatingSupplySWP() {
res, err := suite.queryClient.CirculatingSupplySWP(context.Background(), &types.QueryCirculatingSupplySWPRequest{}) res, err := suite.queryClient.CirculatingSupplySWP(suite.ctx, &types.QueryCirculatingSupplySWPRequest{})
suite.Require().NoError(err) suite.Require().NoError(err)
suite.Require().Equal(sdkmath.NewInt(198437490), res.Amount) suite.Require().Equal(sdkmath.NewInt(201302073), res.Amount)
} }
func (suite *grpcQueryTestSuite) TestTotalSupplyHARD() { func (suite *grpcQueryTestSuite) TestTotalSupplyHARD() {