Skip to content

Commit

Permalink
Make tests ctx aware
Browse files Browse the repository at this point in the history
  • Loading branch information
ValarDragon committed Jun 12, 2022
1 parent bb40562 commit f140a9d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions x/gamm/pool-models/balancer/amm_joinpool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ var calcSingleAssetJoinTestCases = []calcJoinSharesTestCase{
},
}

func TestCalcJoinPoolShares(t *testing.T) {
func (suite *KeeperTestSuite) TestCalcJoinPoolShares() {
// We append shared calcSingleAssetJoinTestCases with multi-asset and edge
// test cases.
//
Expand Down Expand Up @@ -506,12 +506,12 @@ func TestCalcJoinPoolShares(t *testing.T) {
for _, tc := range testCases {
tc := tc

t.Run(tc.name, func(t *testing.T) {
suite.T().Run(tc.name, func(t *testing.T) {
pool := createTestPool(t, tc.swapFee, sdk.ZeroDec(), tc.poolAssets...)

// system under test
sut := func() {
shares, liquidity, err := pool.CalcJoinPoolShares(sdk.Context{}, tc.tokensIn, tc.swapFee)
shares, liquidity, err := pool.CalcJoinPoolShares(suite.Ctx, tc.tokensIn, tc.swapFee)
if tc.expErr != nil {
require.Error(t, err)
require.ErrorAs(t, tc.expErr, &err)
Expand Down
3 changes: 3 additions & 0 deletions x/gamm/pool-models/balancer/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/stretchr/testify/suite"

"github.com/osmosis-labs/osmosis/v9/app/apptesting"
v10 "github.com/osmosis-labs/osmosis/v9/app/upgrades/v10"
"github.com/osmosis-labs/osmosis/v9/x/gamm/types"
)

Expand All @@ -22,4 +23,6 @@ func TestKeeperTestSuite(t *testing.T) {
func (suite *KeeperTestSuite) SetupTest() {
suite.Setup()
suite.queryClient = types.NewQueryClient(suite.QueryHelper)
// be post-bug
suite.Ctx = suite.Ctx.WithBlockHeight(v10.ForkHeight)
}

0 comments on commit f140a9d

Please sign in to comment.