Skip to content

Commit

Permalink
resolve unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jelysn committed Jan 30, 2024
1 parent 54308a1 commit 8dd218d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
9 changes: 6 additions & 3 deletions x/amm/keeper/calc_in_route_by_denom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ package keeper_test
import (
"testing"

keepertest "github.com/elys-network/elys/testutil/keeper"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
simapp "github.com/elys-network/elys/app"
"github.com/stretchr/testify/require"
)

func TestCalcInRouteByDenom(t *testing.T) {
k, ctx, _, _ := keepertest.AmmKeeper(t)
app := simapp.InitElysTestApp(initChain)
ctx := app.BaseApp.NewContext(initChain, tmproto.Header{})
k := app.AmmKeeper

// Setup mock pools and assets
SetupMockPools(k, ctx)
SetupMockPools(&k, ctx)

// Test direct pool route
route, err := k.CalcInRouteByDenom(ctx, "denom1", "denom2", "baseCurrency")
Expand Down
9 changes: 6 additions & 3 deletions x/amm/keeper/calc_out_route_by_denom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ package keeper_test
import (
"testing"

keepertest "github.com/elys-network/elys/testutil/keeper"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
simapp "github.com/elys-network/elys/app"
"github.com/stretchr/testify/require"
)

func TestCalcOutRouteByDenom(t *testing.T) {
k, ctx, _, _ := keepertest.AmmKeeper(t)
app := simapp.InitElysTestApp(initChain)
ctx := app.BaseApp.NewContext(initChain, tmproto.Header{})
k := app.AmmKeeper

// Setup mock pools and assets
SetupMockPools(k, ctx)
SetupMockPools(&k, ctx)

// Test direct pool route
route, err := k.CalcOutRouteByDenom(ctx, "denom2", "denom1", "baseCurrency")
Expand Down
8 changes: 6 additions & 2 deletions x/amm/keeper/pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import (
"strconv"
"testing"

tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
sdk "github.com/cosmos/cosmos-sdk/types"
simapp "github.com/elys-network/elys/app"
keepertest "github.com/elys-network/elys/testutil/keeper"
"github.com/elys-network/elys/testutil/nullify"
"github.com/elys-network/elys/x/amm/keeper"
Expand Down Expand Up @@ -74,8 +76,10 @@ func TestPoolGetAll(t *testing.T) {
}

func TestGetBestPoolWithDenoms(t *testing.T) {
keeper, ctx, _, _ := keepertest.AmmKeeper(t)
items := createNPool(keeper, ctx, 10)
app := simapp.InitElysTestApp(initChain)
ctx := app.BaseApp.NewContext(initChain, tmproto.Header{})
keeper := app.AmmKeeper
items := createNPool(&keeper, ctx, 10)

// Add assets to some pools for testing
for i, item := range items {
Expand Down

0 comments on commit 8dd218d

Please sign in to comment.