Prior to this change, the approvers could only be explicit users. With this change, you can now specify an org team and this will be expanded out with a user list for approvers. Closes #14.
38 lines
756 B
Go
38 lines
756 B
Go
package main
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func TestDeduplicateUsers(t *testing.T) {
|
|
testCases := []struct {
|
|
name string
|
|
input []string
|
|
expected []string
|
|
}{
|
|
{
|
|
name: "with_duplicate_user",
|
|
input: []string{"first", "second", "first"},
|
|
expected: []string{"first", "second"},
|
|
},
|
|
{
|
|
name: "without_duplicate_user",
|
|
input: []string{"first", "second"},
|
|
expected: []string{"first", "second"},
|
|
},
|
|
}
|
|
|
|
for _, testCase := range testCases {
|
|
t.Run(testCase.name, func(t *testing.T) {
|
|
actual := deduplicateUsers(testCase.input)
|
|
if !reflect.DeepEqual(testCase.expected, actual) {
|
|
t.Fatalf(
|
|
"unequal depulicated: expected %v actual %v",
|
|
testCase.expected,
|
|
actual,
|
|
)
|
|
}
|
|
})
|
|
}
|
|
}
|