package common_test

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 := common.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)
			}
		})
	}
}
