Skip to content

Commit

Permalink
Merge pull request #511 from CosmWasm/test-Reply-serialization
Browse files Browse the repository at this point in the history
Add Reply serialization test
  • Loading branch information
chipshort committed Feb 1, 2024
2 parents 4ed2bb3 + d992b04 commit a1bf314
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions types/submessages_test.go
@@ -0,0 +1,34 @@
package types

import (
"encoding/json"
"testing"

"github.com/stretchr/testify/require"
)

func TestReplySerialization(t *testing.T) {
reply1 := Reply{
GasUsed: 4312324,
ID: 75,
Result: SubMsgResult{
Ok: &SubMsgResponse{
Events: []Event{
{
Type: "hi",
Attributes: []EventAttribute{
{
Key: "si",
Value: "claro",
},
},
},
},
Data: []byte{0x3f, 0x00, 0xaa, 0x5c, 0xab},
},
},
}
serialized, err := json.Marshal(&reply1)
require.NoError(t, err)
require.Equal(t, `{"gas_used":4312324,"id":75,"result":{"ok":{"events":[{"type":"hi","attributes":[{"key":"si","value":"claro"}]}],"data":"PwCqXKs="}}}`, string(serialized))
}

0 comments on commit a1bf314

Please sign in to comment.