manual-approval/approvers_test.go
Thomas Stringer 879aad8338 Add ability to specify a team as an approver
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.
2022-07-14 21:57:27 -04:00

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,
)
}
})
}
}