Skip to content

Commit

Permalink
fixed exp error in modules/02-client/types/client-test.go (#7741)
Browse files Browse the repository at this point in the history
Co-authored-by: Damian Nolan <[email protected]>
  • Loading branch information
iIvaki and damiannolan authored Dec 19, 2024
1 parent c5ec835 commit a6ee228
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions modules/core/02-client/types/client_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package types_test

import (
"errors"
"testing"

"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -63,26 +64,26 @@ func TestValidateClientType(t *testing.T) {
testCases := []struct {
name string
clientType string
expPass bool
expError error
}{
{"valid", "tendermint", true},
{"valid solomachine", "solomachine-v1", true},
{"too large", "tenderminttenderminttenderminttenderminttendermintt", false},
{"too short", "t", false},
{"blank id", " ", false},
{"empty id", "", false},
{"ends with dash", "tendermint-", false},
{"valid", "tendermint", nil},
{"valid solomachine", "solomachine-v1", nil},
{"too large", "tenderminttenderminttenderminttenderminttendermintt", errors.New("client type results in largest client identifier being invalid")},
{"too short", "t", errors.New("client type results in smallest client identifier being invalid")},
{"blank id", " ", errors.New("client type cannot be blank")},
{"empty id", "", errors.New("client type cannot be blank")},
{"ends with dash", "tendermint-", errors.New("invalid client type")},
}

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

err := types.ValidateClientType(tc.clientType)

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 a6ee228

Please sign in to comment.