removed some more code smell / error message aggregration

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
Jürgen Eckel 2024-02-26 16:57:22 +01:00
parent 75ed13b357
commit 14241837d3
No known key found for this signature in database
9 changed files with 15 additions and 14 deletions

View File

@ -67,7 +67,7 @@ func (s *AssetDistributionE2ETestSuite) TestAssetDistribution() {
break break
} }
} }
errmsg := "rpc error: code = NotFound desc = distribution not found: key not found"
testCases := []struct { testCases := []struct {
name string name string
requestHeight int64 requestHeight int64
@ -76,17 +76,17 @@ func (s *AssetDistributionE2ETestSuite) TestAssetDistribution() {
{ {
"request height too low", "request height too low",
s.distributionOffset, s.distributionOffset,
"rpc error: code = NotFound desc = distribution not found: key not found", errmsg,
}, },
{ {
"wrong request height", "wrong request height",
height, height,
"rpc error: code = NotFound desc = distribution not found: key not found", errmsg,
}, },
{ {
"request height too high", "request height too high",
2*s.reissaunceEpochs + s.distributionOffset, 2*s.reissaunceEpochs + s.distributionOffset,
"rpc error: code = NotFound desc = distribution not found: key not found", errmsg,
}, },
{ {
"valid distribution request", "valid distribution request",

View File

@ -24,6 +24,7 @@ func GetConnectFunc() mqtt.Token {
// GetDisconnectFunc fetches the mock client's `Disconnect` func // GetDisconnectFunc fetches the mock client's `Disconnect` func
func GetDisconnectFunc(_ uint) { func GetDisconnectFunc(_ uint) {
// not implemented at this point in time
} }
// GetPublishFunc fetches the mock client's `Publish` func // GetPublishFunc fetches the mock client's `Publish` func

View File

@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
func TestMsgInitPop_ValidateBasic(t *testing.T) { func TestMsgInitPopValidateBasic(t *testing.T) {
t.Parallel() t.Parallel()
tests := []struct { tests := []struct {
name string name string
@ -16,7 +16,7 @@ func TestMsgInitPop_ValidateBasic(t *testing.T) {
err error err error
}{ }{
{ {
name: "invalid address", name: sdkerrors.ErrInvalidAddress.Error(),
msg: MsgInitPop{ msg: MsgInitPop{
Creator: errormsg.ErrorInvalidAddress, Creator: errormsg.ErrorInvalidAddress,
}, },

View File

@ -16,7 +16,7 @@ func TestMsgMintToken_ValidateBasic(t *testing.T) {
err error err error
}{ }{
{ {
name: "invalid address", name: sdkerrors.ErrInvalidAddress.Error(),
msg: MsgMintToken{ msg: MsgMintToken{
Creator: errormsg.ErrorInvalidAddress, Creator: errormsg.ErrorInvalidAddress,
}, },

View File

@ -16,7 +16,7 @@ func TestMsgUpdateParams_ValidateBasic(t *testing.T) {
err error err error
}{ }{
{ {
name: "invalid address", name: sdkerrors.ErrInvalidAddress.Error(),
msg: MsgUpdateParams{ msg: MsgUpdateParams{
Authority: errormsg.ErrorInvalidAddress, Authority: errormsg.ErrorInvalidAddress,
}, },

View File

@ -16,7 +16,7 @@ func TestMsgCreateRedeemClaim_ValidateBasic(t *testing.T) {
err error err error
}{ }{
{ {
name: "invalid address", name: sdkerrors.ErrInvalidAddress.Error(),
msg: MsgCreateRedeemClaim{ msg: MsgCreateRedeemClaim{
Creator: errormsg.ErrorInvalidAddress, Creator: errormsg.ErrorInvalidAddress,
}, },
@ -45,7 +45,7 @@ func TestMsgUpdateRedeemClaim_ValidateBasic(t *testing.T) {
err error err error
}{ }{
{ {
name: "invalid address", name: sdkerrors.ErrInvalidAddress.Error(),
msg: MsgUpdateRedeemClaim{ msg: MsgUpdateRedeemClaim{
Creator: errormsg.ErrorInvalidAddress, Creator: errormsg.ErrorInvalidAddress,
}, },
@ -74,7 +74,7 @@ func TestMsgConfirmRedeemClaim_ValidateBasic(t *testing.T) {
err error err error
}{ }{
{ {
name: "invalid address", name: sdkerrors.ErrInvalidAddress.Error(),
msg: MsgConfirmRedeemClaim{ msg: MsgConfirmRedeemClaim{
Creator: errormsg.ErrorInvalidAddress, Creator: errormsg.ErrorInvalidAddress,
}, },

View File

@ -16,7 +16,7 @@ func TestMsgAttestMachineValidateBasic(t *testing.T) {
err error err error
}{ }{
{ {
name: "invalid address", name: sdkerrors.ErrInvalidAddress.Error(),
msg: MsgAttestMachine{ msg: MsgAttestMachine{
Creator: errormsg.ErrorInvalidAddress, Creator: errormsg.ErrorInvalidAddress,
}, },

View File

@ -16,7 +16,7 @@ func TestMsgRegisterTrustAnchor_ValidateBasic(t *testing.T) {
err error err error
}{ }{
{ {
name: "invalid address", name: sdkerrors.ErrInvalidAddress.Error(),
msg: MsgRegisterTrustAnchor{ msg: MsgRegisterTrustAnchor{
Creator: errormsg.ErrorInvalidAddress, Creator: errormsg.ErrorInvalidAddress,
}, },

View File

@ -16,7 +16,7 @@ func TestMsgUpdateParams_ValidateBasic(t *testing.T) {
err error err error
}{ }{
{ {
name: "invalid address", name: sdkerrors.ErrInvalidAddress.Error(),
msg: MsgUpdateParams{ msg: MsgUpdateParams{
Authority: errormsg.ErrorInvalidAddress, Authority: errormsg.ErrorInvalidAddress,
}, },