From a6ee2282b8de9cd99aada0457fc4ff49a27cb9b7 Mon Sep 17 00:00:00 2001 From: iIvaki Date: Thu, 19 Dec 2024 19:46:42 +0200 Subject: [PATCH] fixed exp error in modules/02-client/types/client-test.go (#7741) Co-authored-by: Damian Nolan --- modules/core/02-client/types/client_test.go | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/modules/core/02-client/types/client_test.go b/modules/core/02-client/types/client_test.go index 43b5b1c7f58..6655c04c6e3 100644 --- a/modules/core/02-client/types/client_test.go +++ b/modules/core/02-client/types/client_test.go @@ -1,6 +1,7 @@ package types_test import ( + "errors" "testing" "github.com/stretchr/testify/require" @@ -63,15 +64,15 @@ 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 { @@ -79,10 +80,10 @@ func TestValidateClientType(t *testing.T) { 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()) } } }