Skip to content

Commit

Permalink
increase test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinssgh committed Apr 4, 2024
1 parent 0fcdb89 commit 6f4daa1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
15 changes: 13 additions & 2 deletions zetaclient/zetabridge/broadcast_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func TestBroadcast(t *testing.T) {
msg := observerTypes.NewMsgAddBlockHeader(address.String(), chains.EthChain().ChainId, blockHash, 18495266, getHeaderData(t))
authzMsg, authzSigner, err := zetabridge.WrapMessageWithAuthz(msg)
require.NoError(t, err)
_, err = zetabridge.Broadcast(10000, authzMsg, authzSigner)
_, err = BroadcastToZetaCore(zetabridge, 10000, authzMsg, authzSigner)
require.NoError(t, err)
})

Expand All @@ -93,8 +93,19 @@ func TestBroadcast(t *testing.T) {
msg := observerTypes.NewMsgAddBlockHeader(address.String(), chains.EthChain().ChainId, blockHash, 18495266, getHeaderData(t))
authzMsg, authzSigner, err := zetabridge.WrapMessageWithAuthz(msg)
require.NoError(t, err)
_, err = zetabridge.Broadcast(10000, authzMsg, authzSigner)
_, err = BroadcastToZetaCore(zetabridge, 10000, authzMsg, authzSigner)
require.Error(t, err)
})

}

func TestZetaCoreBridge_GetContext(t *testing.T) {
address := types.AccAddress(stub.TestKeyringPair.PubKey().Address().Bytes())
zetabridge, err := setupCoreBridge()
require.NoError(t, err)
zetabridge.keys = keys.NewKeysWithKeybase(stub.NewKeyring(), address, "", "")

_, err = zetabridge.GetContext()
require.NoError(t, err)

}
8 changes: 4 additions & 4 deletions zetaclient/zetabridge/tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ func TestZetaCoreBridge_PostAddBlockHeader(t *testing.T) {
func TestZetaCoreBridge_PostVoteInbound(t *testing.T) {
address := sdktypes.AccAddress(stub.TestKeyringPair.PubKey().Address().Bytes())

expectedOutput := observertypes.QueryHasVotedResponse{HasVoted: true}
expectedOutput := observertypes.QueryHasVotedResponse{HasVoted: false}
input := observertypes.QueryHasVotedRequest{
BallotIdentifier: "0x2d10e9b7ce7921fa6b61ada3020d1c797d5ec52424cdcf86ef31cbbbcd45db58",
VoterAddress: address.String(),
Expand All @@ -374,7 +374,7 @@ func TestZetaCoreBridge_PostVoteInbound(t *testing.T) {
Creator: address.String(),
})
require.NoError(t, err)
require.Equal(t, "", hash)
require.Equal(t, sampleHash, hash)
})
}

Expand Down Expand Up @@ -420,7 +420,7 @@ func TestZetaCoreBridge_MonitorVoteInboundTxResult(t *testing.T) {
func TestZetaCoreBridge_PostVoteOutbound(t *testing.T) {
address := sdktypes.AccAddress(stub.TestKeyringPair.PubKey().Address().Bytes())

expectedOutput := observertypes.QueryHasVotedResponse{HasVoted: true}
expectedOutput := observertypes.QueryHasVotedResponse{HasVoted: false}
input := observertypes.QueryHasVotedRequest{
BallotIdentifier: "0xc507c67847209b403def6d944486ff888c442eccf924cf9ebdc48714b22b5347",
VoterAddress: address.String(),
Expand Down Expand Up @@ -449,7 +449,7 @@ func TestZetaCoreBridge_PostVoteOutbound(t *testing.T) {
10001,
coin.CoinType_Gas)
require.NoError(t, err)
require.Equal(t, "", hash)
require.Equal(t, sampleHash, hash)
require.Equal(t, "0xc507c67847209b403def6d944486ff888c442eccf924cf9ebdc48714b22b5347", ballot)
}

Expand Down

0 comments on commit 6f4daa1

Please sign in to comment.