Skip to content

Commit

Permalink
chore: remove unnecessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
jaeseung-bae committed Jun 12, 2024
1 parent 6b6c5bf commit 28b44ed
Showing 1 changed file with 0 additions and 55 deletions.
55 changes: 0 additions & 55 deletions x/fswap/types/msgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (
"testing"

"github.com/stretchr/testify/require"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

"github.com/Finschia/finschia-sdk/crypto/keys/secp256k1"
sdk "github.com/Finschia/finschia-sdk/types"
Expand Down Expand Up @@ -89,59 +87,6 @@ func TestAminoJSON(t *testing.T) {
}
}

func TestQuerySwapRequestValidate(t *testing.T) {
tests := []struct {
name string
msg *fswaptypes.QuerySwapRequest
expectedGrpcCode codes.Code
}{
{
name: "valid",
msg: &fswaptypes.QuerySwapRequest{
FromDenom: "cony",
ToDenom: "kei",
},
expectedGrpcCode: codes.OK,
},
{
name: "invalid: nil request",
msg: nil,
expectedGrpcCode: codes.InvalidArgument,
},
{
name: "invalid: empty fromDenom",
msg: &fswaptypes.QuerySwapRequest{
FromDenom: "",
ToDenom: "kei",
},
expectedGrpcCode: codes.InvalidArgument,
},
{
name: "invalid: empty toDenom",
msg: &fswaptypes.QuerySwapRequest{
FromDenom: "cony",
ToDenom: "",
},
expectedGrpcCode: codes.InvalidArgument,
},
{
name: "invalid: the same fromDenom and toDenom",
msg: &fswaptypes.QuerySwapRequest{
FromDenom: "cony",
ToDenom: "cony",
},
expectedGrpcCode: codes.InvalidArgument,
},
}
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
err := tc.msg.Validate()
actualGrpcCode := status.Code(err)
require.Equal(t, tc.expectedGrpcCode, actualGrpcCode)
})
}
}

func TestMsgSwapValidate(t *testing.T) {
pk := secp256k1.GenPrivKey().PubKey()
address, err := sdk.Bech32ifyAddressBytes("link", pk.Address())
Expand Down

0 comments on commit 28b44ed

Please sign in to comment.