diff --git a/x/intertx/types/v1/features/msg_register_account.feature b/x/intertx/types/v1/features/msg_register_account.feature index 68301d131c..d1a472559e 100644 --- a/x/intertx/types/v1/features/msg_register_account.feature +++ b/x/intertx/types/v1/features/msg_register_account.feature @@ -50,4 +50,26 @@ Feature: MsgRegisterAccount } """ When the message is validated - Then expect the error "connection_id cannot be empty: invalid request" \ No newline at end of file + Then expect the error "connection_id cannot be empty: invalid request" + + Scenario: a valid amino msg + Given the message + """ + { + "owner": "regen16md38uw5z9v4du2dtq4qgake8ewyf36u6qgfza", + "connection_id": "channel-5", + "version": "3" + } + """ + When message sign bytes queried + Then expect the sign bytes + """ + { + "type": "intertx/MsgRegisterAccount", + "value":{ + "connection_id": "channel-5", + "owner": "regen16md38uw5z9v4du2dtq4qgake8ewyf36u6qgfza", + "version": "3" + } + } + """ diff --git a/x/intertx/types/v1/msg_register_account_test.go b/x/intertx/types/v1/msg_register_account_test.go index 4d2d906fab..6e3334d6bb 100644 --- a/x/intertx/types/v1/msg_register_account_test.go +++ b/x/intertx/types/v1/msg_register_account_test.go @@ -1,19 +1,22 @@ package v1 import ( + "bytes" "encoding/json" "testing" "github.com/regen-network/gocuke" + "github.com/stretchr/testify/require" "gotest.tools/v3/assert" sdk "github.com/cosmos/cosmos-sdk/types" ) type registerAccountSuite struct { - t gocuke.TestingT - msg *MsgRegisterAccount - err error + t gocuke.TestingT + msg *MsgRegisterAccount + signBytes string + err error } func TestMsgRegisterAccount(t *testing.T) { @@ -44,3 +47,13 @@ func (s *registerAccountSuite) ExpectNoError() { func (s *registerAccountSuite) ExpectTheError(a string) { assert.ErrorContains(s.t, s.err, a) } + +func (s *registerAccountSuite) MessageSignBytesQueried() { + s.signBytes = string(s.msg.GetSignBytes()) +} + +func (s *registerAccountSuite) ExpectTheSignBytes(a gocuke.DocString) { + buffer := new(bytes.Buffer) + require.NoError(s.t, json.Compact(buffer, []byte(a.Content))) + require.Equal(s.t, buffer.String(), s.signBytes) +}