Skip to content

Commit

Permalink
fix tests after changing reflect.wasm file
Browse files Browse the repository at this point in the history
  • Loading branch information
NeverHappened committed Aug 22, 2024
1 parent b25dfeb commit b8530be
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions wasmbinding/test/custom_message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package test
import (
"encoding/json"
"fmt"
contractmanagertypes "github.com/neutron-org/neutron/v4/x/contractmanager/types"
"testing"

"cosmossdk.io/math"
Expand Down Expand Up @@ -543,7 +544,7 @@ func (suite *CustomMessengerTestSuite) TestSubmitTx() {
suite.NoError(err)

var response ictxtypes.MsgSubmitTxResponse
err = json.Unmarshal(data, &response)
err = response.Unmarshal(data)
suite.NoError(err)
suite.Equal(uint64(1), response.SequenceId)
suite.Equal("channel-2", response.Channel)
Expand Down Expand Up @@ -594,11 +595,10 @@ func (suite *CustomMessengerTestSuite) TestSoftwareUpgradeProposal() {
data, err := suite.executeNeutronMsg(suite.contractAddress, msg)
suite.NoError(err)

expected, err := json.Marshal(&admintypes.MsgSubmitProposalResponse{
ProposalId: 1,
})
var expected admintypes.MsgSubmitProposalResponse
err = expected.Unmarshal(data)
suite.NoError(err)
suite.Equal(expected, data)
suite.Equal(expected.ProposalId, uint64(1))

// Test with other proposer that is not admin should return failure
_, err = suite.executeNeutronMsg(anotherContract, msg)
Expand All @@ -623,11 +623,10 @@ func (suite *CustomMessengerTestSuite) TestSoftwareUpgradeProposal() {
data, err = suite.executeNeutronMsg(suite.contractAddress, msg)
suite.NoError(err)

expected, err = json.Marshal(&admintypes.MsgSubmitProposalResponse{
ProposalId: 2,
})
var expected2 admintypes.MsgSubmitProposalResponse
err = expected2.Unmarshal(data)
suite.NoError(err)
suite.Equal(expected, data)
suite.Equal(expected2.ProposalId, uint64(2))
}

func (suite *CustomMessengerTestSuite) TestTooMuchProposals() {
Expand Down Expand Up @@ -745,9 +744,10 @@ func (suite *CustomMessengerTestSuite) TestResubmitFailureAck() {
data, err := suite.executeNeutronMsg(suite.contractAddress, msg)
suite.NoError(err)

expected, err := json.Marshal(&bindings.ResubmitFailureResponse{})
var expected contractmanagertypes.Failure
err = expected.Unmarshal(data)
suite.NoError(err)
suite.Equal(expected, data)
suite.Equal(expected.Id, failureID)
}

func (suite *CustomMessengerTestSuite) TestResubmitFailureTimeout() {
Expand All @@ -769,9 +769,10 @@ func (suite *CustomMessengerTestSuite) TestResubmitFailureTimeout() {
data, err := suite.executeNeutronMsg(suite.contractAddress, msg)
suite.NoError(err)

expected, err := json.Marshal(&bindings.ResubmitFailureResponse{FailureId: failureID})
var expected contractmanagertypes.Failure
err = expected.Unmarshal(data)
suite.NoError(err)
suite.Equal(expected, data)
suite.Equal(expected.Id, failureID)
}

func (suite *CustomMessengerTestSuite) TestResubmitFailureFromDifferentContract() {
Expand Down
Binary file modified wasmbinding/testdata/reflect.wasm
Binary file not shown.

0 comments on commit b8530be

Please sign in to comment.