From dc527a507ebdb7086204647db5a40e83b6793e89 Mon Sep 17 00:00:00 2001 From: Carlton N Hanna Date: Wed, 18 Oct 2023 12:29:37 -0600 Subject: [PATCH] add upgrade test --- app/upgrades_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/app/upgrades_test.go b/app/upgrades_test.go index 1c8e0d042c..1e12645e88 100644 --- a/app/upgrades_test.go +++ b/app/upgrades_test.go @@ -24,6 +24,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/staking/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + markertypes "github.com/provenance-io/provenance/x/marker/types" msgfeetypes "github.com/provenance-io/provenance/x/msgfees/types" ) @@ -845,3 +846,22 @@ func (s *UpgradeTestSuite) TestSetAccountDataNameRecord() { s.Require().NoError(err, "setAccountDataNameRecord") s.AssertLogContents(logOutput, expInLog, nil, true, "setAccountDataNameRecord") } + +func (s *UpgradeTestSuite) TestAddMarkerNavs() { + address1 := sdk.AccAddress("address1") + testcoin := markertypes.NewEmptyMarkerAccount("testcoin", + address1.String(), + []markertypes.AccessGrant{}) + testcoin.Supply = sdk.OneInt() + s.Require().NoError(s.app.MarkerKeeper.AddMarkerAccount(s.ctx, testcoin), "AddMarkerAccount() error") + addMarkerNavs(s.ctx, s.app) + netAssetValues := []markertypes.NetAssetValue{} + err := s.app.MarkerKeeper.IterateNetAssetValues(s.ctx, testcoin.GetAddress(), func(state markertypes.NetAssetValue) (stop bool) { + netAssetValues = append(netAssetValues, state) + return false + }) + s.Require().NoError(err, "IterateNetAssetValues err") + s.Assert().Len(netAssetValues, 1, "Should be 1 nav set for testcoin") + s.Assert().Equal(sdk.NewInt64Coin(markertypes.UsdDenom, int64(150)), netAssetValues[0].Price, "Net asset value price should equal default upgraded price") + s.Assert().Equal(uint64(1), netAssetValues[0].Volume, "Net asset value volume should equal 1") +}