diff --git a/pkg/addons/validations_test.go b/pkg/addons/validations_test.go index 23c2441f8f..aa4cb64038 100644 --- a/pkg/addons/validations_test.go +++ b/pkg/addons/validations_test.go @@ -43,3 +43,36 @@ func TestIsAddonValid(t *testing.T) { }) } } + +func TestContains(t *testing.T) { + tests := []struct { + slice []string + str string + expected bool + }{ + { + slice: []string{}, + str: "test", + expected: false, + }, + { + slice: []string{"test", "test1"}, + str: "test1", + expected: true, + }, + { + slice: []string{"test", "test1"}, + str: "test2", + expected: false, + }, + } + + for _, test := range tests { + t.Run(test.str, func(t *testing.T) { + actual := contains(test.slice, test.str) + if test.expected != actual { + t.Fatalf("slice: %v\nstr: %v\nexpected: %v\nactual:%v\n", test.slice, test.str, test.expected, actual) + } + }) + } +}