cosmos-sdk/types/tx/types_test.go

44 lines
643 B
Go
Raw Normal View History

refactor: Update `GetSigners` to return []string (#9418) <!-- < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < ☺ v ✰ Thanks for creating a PR! ✰ v Before smashing the submit button please review the checkboxes. v If a checkbox is n/a - please still include it but + a little note why ☺ > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > --> ## Description <!-- Add a description of the changes that this PR introduces and the files that are the most critical to review. --> closes: #9239 --- Before we can merge this PR, please make sure that all the following items have been checked off. If any of the checklist items are not applicable, please leave them but write a little note why. - [ ] Targeted PR against correct branch (see [CONTRIBUTING.md](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting)) - [ ] Linked to Github issue with discussion and accepted design OR link to spec that describes this work. - [ ] Code follows the [module structure standards](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules/structure.md). - [ ] Wrote unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing) - [ ] Updated relevant documentation (`docs/`) or specification (`x/<module>/spec/`) - [ ] Added relevant `godoc` [comments](https://blog.golang.org/godoc-documenting-go-code). - [ ] Added a relevant changelog entry to the `Unreleased` section in `CHANGELOG.md` - [ ] Re-reviewed `Files changed` in the Github PR explorer - [ ] Review `Codecov Report` in the comment section below once CI passes
2021-07-07 03:18:00 -07:00
package tx_test
import (
"testing"
"github.com/cosmos/cosmos-sdk/testutil/testdata"
"github.com/cosmos/cosmos-sdk/types/tx"
"github.com/stretchr/testify/suite"
)
type testMsgSuite struct {
suite.Suite
}
func TestValidateMsg(t *testing.T) {
suite.Run(t, new(testMsgSuite))
}
func (s *testMsgSuite) TestMsg() {
cases := []struct {
signer []byte
expErr bool
}{
{
[]byte(""),
true,
},
{
[]byte("validAddress"),
false,
},
}
for _, c := range cases {
msg := testdata.NewTestMsg(c.signer)
err := tx.ValidateMsg(msg)
if c.expErr {
s.Require().Error(err)
} else {
s.Require().NoError(err)
}
}
}