Skip to content

Commit

Permalink
Ensure members are sorted
Browse files Browse the repository at this point in the history
  • Loading branch information
fejta committed Sep 24, 2018
1 parent 20373e9 commit 35cf1ed
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"fmt"
"io/ioutil"
"os"
"sort"
"strings"
"testing"

Expand Down Expand Up @@ -77,6 +78,15 @@ func testDuplicates(list []string) error {
return nil
}

func isSorted(list []string) bool {
items := make([]string, len(list))
for _, l := range list {
items = append(items, strings.ToLower(l))
}

return sort.StringsAreSorted(items)
}

func testOrg(targetDir string, t *testing.T) {
cfg, err := loadOrg(targetDir)
if err != nil {
Expand Down Expand Up @@ -125,6 +135,12 @@ func testOrg(targetDir string, t *testing.T) {
if err := testDuplicates(own.Approvers); err != nil {
t.Errorf("duplicate approvers: %v", err)
}
if !isSorted(cfg.Admins) {
t.Errorf("admins are unsorted")
}
if !isSorted(cfg.Members) {
t.Errorf("members are unsorted")
}
}

func TestAllOrgs(t *testing.T) {
Expand Down

0 comments on commit 35cf1ed

Please sign in to comment.