2019-04-15 09:25:04 -07:00
|
|
|
package bank
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
"testing"
|
|
|
|
|
2019-12-27 09:57:54 -08:00
|
|
|
"github.com/stretchr/testify/require"
|
2020-08-14 10:58:53 -07:00
|
|
|
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
|
2019-04-15 09:25:04 -07:00
|
|
|
|
2020-08-14 10:58:53 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/testutil/testdata"
|
2019-07-22 08:26:42 -07:00
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
2019-12-27 09:57:54 -08:00
|
|
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
2019-04-15 09:25:04 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestInvalidMsg(t *testing.T) {
|
|
|
|
h := NewHandler(nil)
|
|
|
|
|
2020-08-14 10:58:53 -07:00
|
|
|
res, err := h(sdk.NewContext(nil, tmproto.Header{}, false, nil), testdata.NewTestMsg())
|
2019-12-27 09:57:54 -08:00
|
|
|
require.Error(t, err)
|
|
|
|
require.Nil(t, res)
|
|
|
|
|
|
|
|
_, _, log := sdkerrors.ABCIInfo(err, false)
|
|
|
|
require.True(t, strings.Contains(log, "unrecognized bank message type"))
|
2019-04-15 09:25:04 -07:00
|
|
|
}
|