mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-07-04 17:06:49 +00:00
Add more backend unit tests
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
@ -90,3 +91,21 @@ func TestConvertIntSliceToString(t *testing.T) {
|
||||
str := ConvertIntSliceToString(items)
|
||||
assert.Equal(t, expectedStr, str)
|
||||
}
|
||||
|
||||
func TestConvertStringSliceToInterface(t *testing.T) {
|
||||
testCases := []struct {
|
||||
input []string
|
||||
expected []interface{}
|
||||
}{
|
||||
{[]string{"hello", "world"}, []interface{}{"hello", "world"}},
|
||||
{[]string{"apple", "banana", "cherry"}, []interface{}{"apple", "banana", "cherry"}},
|
||||
{[]string{}, []interface{}{}}, // Empty slice should return an empty slice
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
result := ConvertStringSliceToInterface(tc.input)
|
||||
if !reflect.DeepEqual(result, tc.expected) {
|
||||
t.Errorf("Expected: %v, Got: %v", tc.expected, result)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user