mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-11-27 07:48:29 +00:00
linter pleasure
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
parent
6fe2ab643e
commit
2696a52a53
@ -1,6 +1,7 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
errorsmod "cosmossdk.io/errors"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
)
|
||||
@ -40,7 +41,7 @@ func (msg *MsgUpdateParams) GetSignBytes() []byte {
|
||||
func (msg *MsgUpdateParams) ValidateBasic() error {
|
||||
_, err := sdk.AccAddressFromBech32(msg.Authority)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid authority address (%s)", err)
|
||||
return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid authority address (%s)", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -4,11 +4,11 @@ import (
|
||||
"testing"
|
||||
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
"github.com/planetmint/planetmint-go/testutil/sample"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestMsgUpdateParams_ValidateBasic(t *testing.T) {
|
||||
t.Parallel()
|
||||
tests := []struct {
|
||||
name string
|
||||
msg MsgUpdateParams
|
||||
@ -20,15 +20,12 @@ func TestMsgUpdateParams_ValidateBasic(t *testing.T) {
|
||||
Authority: "invalid_address",
|
||||
},
|
||||
err: sdkerrors.ErrInvalidAddress,
|
||||
}, {
|
||||
name: "valid address",
|
||||
msg: MsgUpdateParams{
|
||||
Authority: sample.AccAddress(),
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
err := tt.msg.ValidateBasic()
|
||||
if tt.err != nil {
|
||||
require.ErrorIs(t, err, tt.err)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user