refactor(test)!: refactor simapp.Setup function (#9938)
<!-- The default pull request template is for types feat, fix, or refactor. For other templates, add one of the following parameters to the url: - template=docs.md - template=other.md --> ## Description ref: #8961 <!-- Add a description of the changes that this PR introduces and the files that are the most critical to review. --> Following up on [#9697](https://github.com/cosmos/cosmos-sdk/pull/9697#pullrequestreview-727295733), this PR is the first step for the #8961. --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [x] added `!` to the type prefix if API or client breaking change - [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting)) - [x] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules) - [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing) - [x] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable)
This commit is contained in:
@@ -2,6 +2,7 @@ package query_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/store/prefix"
|
||||
@@ -15,7 +16,7 @@ import (
|
||||
var addr1 = sdk.AccAddress([]byte("addr1"))
|
||||
|
||||
func (s *paginationTestSuite) TestFilteredPaginations() {
|
||||
app, ctx, appCodec := setupTest()
|
||||
app, ctx, appCodec := setupTest(s.T())
|
||||
|
||||
var balances sdk.Coins
|
||||
for i := 0; i < numBalances; i++ {
|
||||
@@ -90,7 +91,7 @@ func (s *paginationTestSuite) TestFilteredPaginations() {
|
||||
}
|
||||
|
||||
func (s *paginationTestSuite) TestReverseFilteredPaginations() {
|
||||
app, ctx, appCodec := setupTest()
|
||||
app, ctx, appCodec := setupTest(s.T())
|
||||
|
||||
var balances sdk.Coins
|
||||
for i := 0; i < numBalances; i++ {
|
||||
@@ -170,8 +171,8 @@ func (s *paginationTestSuite) TestReverseFilteredPaginations() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleFilteredPaginate() {
|
||||
app, ctx, _ := setupTest()
|
||||
func ExampleFilteredPaginate(t *testing.T) {
|
||||
app, ctx, _ := setupTest(t)
|
||||
|
||||
var balances sdk.Coins
|
||||
for i := 0; i < numBalances; i++ {
|
||||
|
||||
@@ -61,7 +61,7 @@ func (s *paginationTestSuite) TestParsePagination() {
|
||||
}
|
||||
|
||||
func (s *paginationTestSuite) TestPagination() {
|
||||
app, ctx, _ := setupTest()
|
||||
app, ctx, _ := setupTest(s.T())
|
||||
queryHelper := baseapp.NewQueryServerTestHelper(ctx, app.InterfaceRegistry())
|
||||
types.RegisterQueryServer(queryHelper, app.BankKeeper)
|
||||
queryClient := types.NewQueryClient(queryHelper)
|
||||
@@ -170,7 +170,7 @@ func (s *paginationTestSuite) TestPagination() {
|
||||
}
|
||||
|
||||
func (s *paginationTestSuite) TestReversePagination() {
|
||||
app, ctx, _ := setupTest()
|
||||
app, ctx, _ := setupTest(s.T())
|
||||
queryHelper := baseapp.NewQueryServerTestHelper(ctx, app.InterfaceRegistry())
|
||||
types.RegisterQueryServer(queryHelper, app.BankKeeper)
|
||||
queryClient := types.NewQueryClient(queryHelper)
|
||||
@@ -293,8 +293,8 @@ func (s *paginationTestSuite) TestReversePagination() {
|
||||
s.Require().Nil(res.Pagination.NextKey)
|
||||
}
|
||||
|
||||
func ExamplePaginate() {
|
||||
app, ctx, _ := setupTest()
|
||||
func ExamplePaginate(t *testing.T) {
|
||||
app, ctx, _ := setupTest(t)
|
||||
|
||||
var balances sdk.Coins
|
||||
|
||||
@@ -335,8 +335,8 @@ func ExamplePaginate() {
|
||||
// balances:<denom:"foo0denom" amount:"100" > pagination:<next_key:"foo1denom" total:2 >
|
||||
}
|
||||
|
||||
func setupTest() (*simapp.SimApp, sdk.Context, codec.Codec) {
|
||||
app := simapp.Setup(false)
|
||||
func setupTest(t *testing.T) (*simapp.SimApp, sdk.Context, codec.Codec) {
|
||||
app := simapp.Setup(t, false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{Height: 1})
|
||||
appCodec := app.AppCodec()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user