-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e61c72b
commit c806f34
Showing
4 changed files
with
100 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package types_test | ||
|
||
import ( | ||
"testing" | ||
|
||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" | ||
"github.com/google/uuid" | ||
"github.com/sge-network/sge/testutil/sample" | ||
"github.com/sge-network/sge/x/reward/types" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestMsgApplyReward_ValidateBasic(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
msg types.MsgApplyReward | ||
err error | ||
}{ | ||
{ | ||
name: "invalid address", | ||
msg: types.MsgApplyReward{ | ||
Creator: "invalid_address", | ||
}, | ||
err: sdkerrors.ErrInvalidAddress, | ||
}, | ||
{ | ||
name: "invalid uid", | ||
msg: types.MsgApplyReward{ | ||
Creator: sample.AccAddress(), | ||
CampaignUid: "bad uid", | ||
Ticket: "ticket", | ||
}, | ||
err: sdkerrors.ErrInvalidRequest, | ||
}, | ||
{ | ||
name: "invalid ticket", | ||
msg: types.MsgApplyReward{ | ||
Creator: sample.AccAddress(), | ||
CampaignUid: uuid.NewString(), | ||
}, | ||
err: sdkerrors.ErrInvalidRequest, | ||
}, | ||
{ | ||
name: "valid address", | ||
msg: types.MsgApplyReward{ | ||
Creator: sample.AccAddress(), | ||
CampaignUid: uuid.NewString(), | ||
Ticket: "ticket", | ||
}, | ||
}, | ||
} | ||
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) | ||
}) | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.