refactor(docs): remove duplicate util func to format possible values (#1050)

This commit is contained in:
Ruben Hönle 2025-11-11 16:24:48 +01:00 committed by GitHub
parent 64d6fa9bea
commit 52b879b436
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 30 additions and 77 deletions

View file

@ -110,20 +110,6 @@ func ConvertPointerSliceToStringSlice(pointerSlice []*string) []string {
}
return stringSlice
}
func SupportedValuesDocumentation(values []string) string {
if len(values) == 0 {
return ""
}
return "Supported values are: " + strings.Join(QuoteValues(values), ", ") + "."
}
func QuoteValues(values []string) []string {
quotedValues := make([]string, len(values))
for i, value := range values {
quotedValues[i] = fmt.Sprintf("`%s`", value)
}
return quotedValues
}
func IsLegacyProjectRole(role string) bool {
return utils.Contains(LegacyProjectRoles, role)

View file

@ -253,39 +253,6 @@ func TestSimplifyBackupSchedule(t *testing.T) {
}
}
func TestSupportedValuesDocumentation(t *testing.T) {
tests := []struct {
description string
values []string
expected string
}{
{
"empty values",
[]string{},
"",
},
{
"single value",
[]string{"value"},
"Supported values are: `value`.",
},
{
"multiple values",
[]string{"value1", "value2", "value3"},
"Supported values are: `value1`, `value2`, `value3`.",
},
}
for _, tt := range tests {
t.Run(tt.description, func(t *testing.T) {
output := SupportedValuesDocumentation(tt.values)
if output != tt.expected {
t.Fatalf("Data does not match: %s", output)
}
})
}
}
func TestIsLegacyProjectRole(t *testing.T) {
tests := []struct {
description string