mock

package
v0.21.0-rc.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendCtxWithMockLogger

func AppendCtxWithMockLogger(t *testing.T, ctx sdk.Context) (sdk.Context, *sdktestsmocks.MockLogger)
AppendCtxWithMockLogger sets the logger for an input context as a mock logger

with 'EXPECT' statements. This enables testing on functions logged to the context. For example,

```go // This is a passing test example import (

gomock "github.com/golang/mock/gomock"
sdktestsmocks "github.com/cosmos/cosmos-sdk/tests/mocks"

)

// assume t is a *testing.T variable.
ctx, logger := AppendCtxWithMockLogger(t, ctx)
logger.EXPECT().Debug("debug")
logger.EXPECT().Info("info")
logger.EXPECT().Error("error")

ctx.Logger().Debug("debug")
ctx.Logger().Info("info")
ctx.Logger().Error("error")

```

func SpotPool

func SpotPool(poolId uint64, assets sdk.Coins, shares int64) types.Pool

helper function to create dummy test pools

func SpotStablePool

func SpotStablePool(poolId uint64, assets sdk.Coins, shares int64) types.Pool

helper function to create dummy test pools

func TestAMM added in v0.21.0

func TestAMM(sqrtK sdk.Dec, priceMultiplier sdk.Dec) *types.AMM

default market with sensible values for tests

func TestAMMDefault added in v0.21.0

func TestAMMDefault() *types.AMM

default market with sensible values for tests

func TestMarket added in v0.21.0

func TestMarket() *types.Market

default market with sensible values for tests

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL