Skip to content

Commit

Permalink
Simplify if else statement
Browse files Browse the repository at this point in the history
  • Loading branch information
grischperl committed Jul 18, 2023
1 parent 0b3a6f6 commit fdfef88
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package validation_test

import (
"fmt"
"github.com/kyma-project/eventing-manager/api/v1alpha1"
"github.com/kyma-project/eventing-manager/testutils"
"github.com/kyma-project/eventing-manager/testutils/integration"
Expand Down Expand Up @@ -116,7 +117,7 @@ func Test_Validate_CreateEventing(t *testing.T) {
spec: map[string]any{
publisher: map[string]any{
replicas: map[string]any{
min: 3,
min: 2,
max: 2,
},
},
Expand Down Expand Up @@ -436,14 +437,11 @@ func Test_Validate_CreateEventing(t *testing.T) {
require.NoError(t, err, "Expected error message to be empty but got error instead."+
" Check the validation rule of the eventing CR.")
} else {
if err != nil {
require.Contains(t, err.Error(), tc.wantErrMsg, "Expected a specific error message"+
" but messages do not match. Check the validation rules of the eventing CR.")
} else {
require.Error(t, err, "Expected the following error message: \""+tc.wantErrMsg+
".\" but got no error. Check the validation rules of the eventing CR.")
}
require.Error(t, err, fmt.Sprintf("Expected the following error message: \n \" %s \" \n"+
" but got no error. Check the validation rules of the eventing CR.", tc.wantErrMsg))

require.Contains(t, err.Error(), tc.wantErrMsg, "Expected a specific error message"+
" but messages do not match. Check the validation rules of the eventing CR.")
}
})
}
Expand Down

0 comments on commit fdfef88

Please sign in to comment.