autogits/workflow-pr/reviewers_test.go

39 lines
769 B
Go
Raw Normal View History

2025-02-05 14:43:38 +01:00
package main
import (
"slices"
"testing"
"src.opensuse.org/autogits/common"
)
func TestReviewers(t *testing.T) {
tests := []struct {
name string
input []string
prj []string
pkg []string
}{
{
name: "project and package reviewers",
input: []string{"1", "2", "3", "*5", "+6", "-7"},
prj: []string{"5", "7", common.Bot_BuildReview},
pkg: []string{"1", "2", "3", "5", "6"},
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
reviewers := ParseReviewers(test.input)
if !slices.Equal(reviewers.Prj, test.prj) {
t.Error("unexpected return of ForProject():", reviewers.Prj)
}
if !slices.Equal(reviewers.Pkg, test.pkg) {
t.Error("unexpected return of ForProject():", reviewers.Pkg)
}
})
}
}