Skip to content

Commit

Permalink
fix experror in parasm test (#7731)
Browse files Browse the repository at this point in the history
Co-authored-by: DimitrisJim <[email protected]>
  • Loading branch information
iIvaki and DimitrisJim authored Dec 18, 2024
1 parent 0b2866d commit 219bbd4
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions modules/core/02-client/types/params_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package types

import (
"errors"
"testing"

"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -31,26 +32,27 @@ func TestIsAllowedClient(t *testing.T) {

func TestValidateParams(t *testing.T) {
testCases := []struct {
name string
params Params
expPass bool
name string
params Params
expError error
}{
{"default params", DefaultParams(), true},
{"custom params", NewParams(exported.Tendermint), true},
{"blank client", NewParams(" "), false},
{"duplicate clients", NewParams(exported.Tendermint, exported.Tendermint), false},
{"allow all clients plus valid client", NewParams(AllowAllClients, exported.Tendermint), false},
{"too many allowed clients", NewParams(make([]string, MaxAllowedClientsLength+1)...), false},
{"default params", DefaultParams(), nil},
{"custom params", NewParams(exported.Tendermint), nil},
{"blank client", NewParams(" "), errors.New("client type 0 cannot be blank")},
{"duplicate clients", NewParams(exported.Tendermint, exported.Tendermint), errors.New("duplicate client type: 07-tendermint")},
{"allow all clients plus valid client", NewParams(AllowAllClients, exported.Tendermint), errors.New("allow list must have only one element because the allow all clients wildcard (*) is present")},
{"too many allowed clients", NewParams(make([]string, MaxAllowedClientsLength+1)...), errors.New("allowed clients length must not exceed 200 items")},
}

for _, tc := range testCases {
tc := tc

err := tc.params.Validate()
if tc.expPass {
if tc.expError == nil {
require.NoError(t, err, tc.name)
} else {
require.Error(t, err, tc.name)
require.ErrorContains(t, err, tc.expError.Error())
}
}
}

0 comments on commit 219bbd4

Please sign in to comment.