Skip to content

Commit

Permalink
feat: add codespace to broadcast response (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yongwoo Lee authored and Woosang Son committed Mar 19, 2021
1 parent 78226eb commit 1cdefea
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions types/result_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,25 @@ func TestWrapServiceResult(t *testing.T) {
require.NoError(t, err)
require.Equal(t, spot, spot2)
}

func TestNewResponseFormatBroadcastTx(t *testing.T) {
hash, err := hex.DecodeString("00000000000000000000000000000000")
require.NoError(t, err)
result := ctypes.ResultBroadcastTx{
Code: 1,
Data: []byte("some data"),
Log: `[{"log":"","msg_index":1,"success":true}]`,
Codespace: "codespace",
Hash: hash,
}

txResponse := sdk.NewResponseFormatBroadcastTx(&result)

require.NoError(t, err)
require.Equal(t, result.Code, txResponse.Code)
require.Equal(t, result.Data.String(), txResponse.Data)
require.NotEmpty(t, txResponse.Logs)
require.Equal(t, result.Log, txResponse.RawLog)
require.Equal(t, result.Codespace, txResponse.Codespace)
require.Equal(t, result.Hash.String(), txResponse.TxHash)
}

0 comments on commit 1cdefea

Please sign in to comment.