Skip to content

Commit

Permalink
upgrade tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pr0n00gler committed Sep 25, 2024
1 parent 2a81f5d commit f7bd796
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions app/upgrades/v5.0.0/upgrades_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package v500_test

import (
"testing"

"cosmossdk.io/math"
upgradetypes "cosmossdk.io/x/upgrade/types"
"github.com/stretchr/testify/suite"

v500 "github.com/neutron-org/neutron/v5/app/upgrades/v5.0.0"
"github.com/neutron-org/neutron/v5/testutil/common/sample"

"github.com/neutron-org/neutron/v5/testutil"
dexkeeper "github.com/neutron-org/neutron/v5/x/dex/keeper"
dextypes "github.com/neutron-org/neutron/v5/x/dex/types"
)

type UpgradeTestSuite struct {
testutil.IBCConnectionTestSuite
}

func TestKeeperTestSuite(t *testing.T) {
suite.Run(t, new(UpgradeTestSuite))
}

func (suite *UpgradeTestSuite) SetupTest() {
suite.IBCConnectionTestSuite.SetupTest()
}

func (suite *UpgradeTestSuite) TestUpgradeDexPause() {
var (
app = suite.GetNeutronZoneApp(suite.ChainA)
ctx = suite.ChainA.GetContext().WithChainID("neutron-1")
msgServer = dexkeeper.NewMsgServerImpl(app.DexKeeper)
)

params := app.DexKeeper.GetParams(ctx)

suite.False(params.Paused)

upgrade := upgradetypes.Plan{
Name: v500.UpgradeName,
Info: "some text here",
Height: 100,
}
suite.NoError(app.UpgradeKeeper.ApplyUpgrade(ctx, upgrade))

params = app.DexKeeper.GetParams(ctx)

suite.True(params.Paused)

_, err := msgServer.Deposit(ctx, &dextypes.MsgDeposit{
Creator: sample.AccAddress(),
Receiver: sample.AccAddress(),
TokenA: "TokenA",
TokenB: "TokenB",
TickIndexesAToB: []int64{1},
Fees: []uint64{1},
AmountsA: []math.Int{math.OneInt()},
AmountsB: []math.Int{math.ZeroInt()},
Options: []*dextypes.DepositOptions{{}},
})

suite.ErrorIs(err, dextypes.ErrDexPaused)
}

0 comments on commit f7bd796

Please sign in to comment.