Skip to content

Commit

Permalink
config: missing test for issues
Browse files Browse the repository at this point in the history
Signed-off-by: Galo Navarro <[email protected]>
  • Loading branch information
srvaroa committed Feb 20, 2023
1 parent d6fe366 commit 74e00e5
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 17 deletions.
37 changes: 37 additions & 0 deletions cmd/action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,43 @@ func TestGetLabelerConfigV1(t *testing.T) {
}
}

func TestGetLabelerConfigV1WithIssues(t *testing.T) {

file, err := os.Open("../test_data/config_v1_issues.yml")
if err != nil {
t.Fatal(err)
}

contents, err := ioutil.ReadAll(file)
if err != nil {
t.Fatal(err)
}

var c *l.LabelerConfigV1
c, err = getLabelerConfig(&contents)
if err != nil {
t.Fatal(err)
}

expect := l.LabelerConfigV1{
Version: 1,
Issues: true,
Labels: []l.LabelMatcher{
{
Label: "Test",
Authors: []string{
"Test1",
"Test2",
},
},
},
}

if !cmp.Equal(expect, *c) {
t.Fatalf("Expect: %+v Got: %+v", expect, c)
}
}

func TestGetLabelerConfig2V1(t *testing.T) {

file, err := os.Open("../test_data/config2_v1.yml")
Expand Down
17 changes: 0 additions & 17 deletions test_data/config_v1_issues.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
version: 1
issues: True
labels:
- label: WIP
branch: "wip"
- label: WIP
title: "^WIP:.*"
- label: WOP
title: "^WOP:.*"
- label: S
size-below: 10
- label: M
size-above: 9
size-below: 100
- label: L
size-above: 100
- label: "TestFileMatch"
files:
- "cmd/.*.go"
- "pkg/.*.go"
- label: "Test"
authors:
- "Test1"
Expand Down

0 comments on commit 74e00e5

Please sign in to comment.