Skip to content

Commit

Permalink
fix(test): fix cycle import
Browse files Browse the repository at this point in the history
  • Loading branch information
hoank101 committed Jan 9, 2024
1 parent 6a01d49 commit 7bc2907
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 241 deletions.
146 changes: 0 additions & 146 deletions app/app_test.go

This file was deleted.

2 changes: 1 addition & 1 deletion app/testing/mock.go → app/mock.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package helpers
package app

import (
"github.com/cometbft/cometbft/crypto"
Expand Down
11 changes: 6 additions & 5 deletions app/sim_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
package app

import (
"cosmossdk.io/simapp"
"encoding/json"
"fmt"
"os"
"path/filepath"
"testing"
"time"

"cosmossdk.io/simapp"
"github.com/CosmWasm/wasmd/x/wasm"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
dbm "github.com/cometbft/cometbft-db"
Expand Down Expand Up @@ -36,10 +41,6 @@ import (
ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
"github.com/stretchr/testify/require"
"os"
"path/filepath"
"testing"
"time"
)

// Get flags every time the simulator is run
Expand Down
73 changes: 0 additions & 73 deletions app/test_access.go

This file was deleted.

28 changes: 14 additions & 14 deletions app/testing/test_helpers.go → app/test_helpers.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package helpers
package app

import (
"encoding/json"
"testing"
"time"

"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
"github.com/White-Whale-Defi-Platform/migaloo-chain/v3/app"
config "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/app/params"
dbm "github.com/cometbft/cometbft-db"
abci "github.com/cometbft/cometbft/abci/types"
Expand All @@ -25,8 +27,6 @@ import (
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"testing"
"time"
)

// SimAppChainID hardcoded chainID for simulation
Expand All @@ -39,7 +39,7 @@ var emptyWasmOpts []wasm.Option
type KeeperTestHelper struct {
suite.Suite

App *app.MigalooApp
App *MigalooApp
Ctx sdk.Context // ctx is deliver ctx
CheckCtx sdk.Context
QueryHelper *baseapp.QueryServiceTestHelper
Expand Down Expand Up @@ -81,7 +81,7 @@ type EmptyAppOptions struct{}

func (EmptyAppOptions) Get(_ string) interface{} { return nil }

func SetupApp(t *testing.T) *app.MigalooApp {
func SetupApp(t *testing.T) *MigalooApp {
t.Helper()

privVal := NewPV()
Expand All @@ -108,7 +108,7 @@ func SetupApp(t *testing.T) *app.MigalooApp {
// that also act as delegators. For simplicity, each validator is bonded with a delegation
// of one consensus engine unit in the default token of the app from first genesis
// account. A Nop logger is set in app.
func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *app.MigalooApp {
func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *MigalooApp {
t.Helper()

migalooApp, genesisState := setup(true)
Expand Down Expand Up @@ -140,23 +140,23 @@ func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs
return migalooApp
}

func setup(withGenesis bool, opts ...wasmkeeper.Option) (*app.MigalooApp, app.GenesisState) {
func setup(withGenesis bool, opts ...wasmkeeper.Option) (*MigalooApp, GenesisState) {
db := dbm.NewMemDB()
migalooApp := app.NewMigalooApp(log.NewNopLogger(), db, nil, true, map[int64]bool{},
app.DefaultNodeHome, 5, app.MakeEncodingConfig(), EmptyBaseAppOptions{}, opts)
migalooApp := NewMigalooApp(log.NewNopLogger(), db, nil, true, map[int64]bool{},
DefaultNodeHome, 5, MakeEncodingConfig(), EmptyBaseAppOptions{}, opts)

if withGenesis {
return migalooApp, app.NewDefaultGenesisState()
return migalooApp, NewDefaultGenesisState()
}

return migalooApp, app.GenesisState{}
return migalooApp, GenesisState{}
}

func genesisStateWithValSet(t *testing.T,
app *app.MigalooApp, genesisState app.GenesisState,
app *MigalooApp, genesisState GenesisState,
valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount,
balances ...banktypes.Balance,
) app.GenesisState {
) GenesisState {
// set genesis accounts
authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs)
genesisState[authtypes.ModuleName] = app.AppCodec().MustMarshalJSON(authGenesis)
Expand Down
2 changes: 1 addition & 1 deletion x/feeburn/ante/utils_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package ante_test

import (
apptesting "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/app"
config "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/app/params"
apptesting "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/app/testing"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
Expand Down
2 changes: 1 addition & 1 deletion x/feeburn/keeper/keeper_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package keeper_test

import (
apptesting "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/app"
config "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/app/params"
apptesting "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/app/testing"
"github.com/cometbft/cometbft/crypto/ed25519"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/tx"
Expand Down

0 comments on commit 7bc2907

Please sign in to comment.