42 lines
716 B
Go
42 lines
716 B
Go
|
package types
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"colinear/testutil/sample"
|
||
|
|
||
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||
|
"github.com/stretchr/testify/require"
|
||
|
)
|
||
|
|
||
|
func TestMsgNewBid_ValidateBasic(t *testing.T) {
|
||
|
tests := []struct {
|
||
|
name string
|
||
|
msg MsgNewBid
|
||
|
err error
|
||
|
}{
|
||
|
{
|
||
|
name: "invalid address",
|
||
|
msg: MsgNewBid{
|
||
|
Creator: "invalid_address",
|
||
|
},
|
||
|
err: sdkerrors.ErrInvalidAddress,
|
||
|
}, {
|
||
|
name: "valid address",
|
||
|
msg: MsgNewBid{
|
||
|
Creator: sample.AccAddress(),
|
||
|
},
|
||
|
},
|
||
|
}
|
||
|
for _, tt := range tests {
|
||
|
t.Run(tt.name, func(t *testing.T) {
|
||
|
err := tt.msg.ValidateBasic()
|
||
|
if tt.err != nil {
|
||
|
require.ErrorIs(t, err, tt.err)
|
||
|
return
|
||
|
}
|
||
|
require.NoError(t, err)
|
||
|
})
|
||
|
}
|
||
|
}
|