Skip to content

Commit

Permalink
refactor: remove suite from chaindecorator handler test #14173
Browse files Browse the repository at this point in the history
  • Loading branch information
tac0turtle authored Dec 6, 2022
1 parent 14c9dc6 commit fa6e679
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions types/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,22 @@ import (
"testing"

"github.com/golang/mock/gomock"
"github.com/stretchr/testify/suite"
"github.com/stretchr/testify/require"

"github.com/cosmos/cosmos-sdk/testutil/mock"
sdk "github.com/cosmos/cosmos-sdk/types"
)

type handlerTestSuite struct {
suite.Suite
}

func TestHandlerTestSuite(t *testing.T) {
suite.Run(t, new(handlerTestSuite))
}

func (s *handlerTestSuite) SetupSuite() {
s.T().Parallel()
}

func (s *handlerTestSuite) TestChainAnteDecorators() {
func TestChainAnteDecorators(t *testing.T) {
// test panic
s.Require().Nil(sdk.ChainAnteDecorators([]sdk.AnteDecorator{}...))
require.Nil(t, sdk.ChainAnteDecorators([]sdk.AnteDecorator{}...))

ctx, tx := sdk.Context{}, sdk.Tx(nil)
mockCtrl := gomock.NewController(s.T())
mockCtrl := gomock.NewController(t)
mockAnteDecorator1 := mock.NewMockAnteDecorator(mockCtrl)
mockAnteDecorator1.EXPECT().AnteHandle(gomock.Eq(ctx), gomock.Eq(tx), true, gomock.Any()).Times(1)
_, err := sdk.ChainAnteDecorators(mockAnteDecorator1)(ctx, tx, true)
s.Require().NoError(err)
require.NoError(t, err)

mockAnteDecorator2 := mock.NewMockAnteDecorator(mockCtrl)
// NOTE: we can't check that mockAnteDecorator2 is passed as the last argument because
Expand All @@ -43,5 +31,5 @@ func (s *handlerTestSuite) TestChainAnteDecorators() {
_, err = sdk.ChainAnteDecorators(
mockAnteDecorator1,
mockAnteDecorator2)(ctx, tx, true)
s.Require().NoError(err)
require.NoError(t, err)
}

0 comments on commit fa6e679

Please sign in to comment.