diff --git a/protocol/chainlib/grpc_test.go b/protocol/chainlib/grpc_test.go index 1d9a21fcc5..cd3404b2b6 100644 --- a/protocol/chainlib/grpc_test.go +++ b/protocol/chainlib/grpc_test.go @@ -5,7 +5,6 @@ import ( "fmt" "net/http" "strconv" - "strings" "testing" "time" @@ -94,10 +93,9 @@ func TestGRPCGetSupportedApi(t *testing.T) { } apiCont, err = apip.getSupportedApi("API2", connectionType_test) if err == nil { - require.True(t, apiCont.api.Name == "Default-API2") + require.Equal(t, "Default-API2", apiCont.api.Name) } else { - found := strings.Contains(err.Error(), "api not supported") - require.True(t, found) + require.Contains(t, err.Error(), "api not supported") } // Test case 3: Returns error if the API is disabled @@ -108,8 +106,7 @@ func TestGRPCGetSupportedApi(t *testing.T) { } _, err = apip.getSupportedApi("API1", connectionType_test) assert.Error(t, err) - found := strings.Contains(err.Error(), "api is disabled") - require.True(t, found) + require.Contains(t, err.Error(), "api is disabled") } func TestGRPCParseMessage(t *testing.T) { diff --git a/protocol/chainlib/jsonRPC_test.go b/protocol/chainlib/jsonRPC_test.go index bb428bd56a..1510458704 100644 --- a/protocol/chainlib/jsonRPC_test.go +++ b/protocol/chainlib/jsonRPC_test.go @@ -117,7 +117,7 @@ func TestJSONGetSupportedApi(t *testing.T) { } apiCont, err := apip.getSupportedApi("API2", connectionType_test, "") if err == nil { - require.True(t, apiCont.api.Name == "Default-API2") + assert.Equal(t, "Default-API2", apiCont.api.Name) } else { assert.ErrorIs(t, err, common.APINotSupportedError) } @@ -504,7 +504,7 @@ func TestJsonRpcInternalPathsMultipleVersionsAvalanche(t *testing.T) { require.Equal(t, correctPath, collection.CollectionData.InternalPath) } else { if err == nil { - require.True(t, strings.Contains(chainMessage.GetApi().Name, "Default-")) + require.Contains(t, chainMessage.GetApi().Name, "Default-") } else { require.ErrorIs(t, err, common.APINotSupportedError) require.Nil(t, chainMessage) diff --git a/protocol/chainlib/rest_test.go b/protocol/chainlib/rest_test.go index c1393eb057..18370af01a 100644 --- a/protocol/chainlib/rest_test.go +++ b/protocol/chainlib/rest_test.go @@ -90,7 +90,7 @@ func TestRestGetSupportedApi(t *testing.T) { } apiCont, err := apip.getSupportedApi("API2", connectionType_test) if err == nil { - require.True(t, apiCont.api.Name == "Default-API2") + assert.Equal(t, "Default-API2", apiCont.api.Name) } else { assert.ErrorIs(t, err, common.APINotSupportedError) } @@ -318,7 +318,7 @@ func TestRegexParsing(t *testing.T) { } { chainMessage, err := chainParser.ParseMsg(api, nil, http.MethodGet, nil, extensionslib.ExtensionInfo{LatestBlock: 0}) if err == nil { - require.True(t, chainMessage.GetApi().GetName() == "Default-"+api) + require.Equal(t, "Default-"+api, chainMessage.GetApi().GetName()) } else { assert.ErrorIs(t, err, common.APINotSupportedError) } diff --git a/protocol/chainlib/tendermintRPC_test.go b/protocol/chainlib/tendermintRPC_test.go index 17b2509706..1fd6696ebb 100644 --- a/protocol/chainlib/tendermintRPC_test.go +++ b/protocol/chainlib/tendermintRPC_test.go @@ -87,7 +87,7 @@ func TestTendermintGetSupportedApi(t *testing.T) { } apiCont, err := apip.getSupportedApi("API2", connectionType_test) if err == nil { - require.True(t, apiCont.api.Name == "Default-API2") + assert.Equal(t, "Default-API2", apiCont.api.Name) } else { assert.ErrorIs(t, err, common.APINotSupportedError) }