forked from zaquestion/lab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathissue_list_test.go
74 lines (60 loc) · 1.52 KB
/
issue_list_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package cmd
import (
"os/exec"
"strings"
"testing"
"github.com/stretchr/testify/require"
)
func Test_issueList(t *testing.T) {
t.Parallel()
repo := copyTestRepo(t)
cmd := exec.Command(labBinaryPath, "issue", "list")
cmd.Dir = repo
b, err := cmd.CombinedOutput()
if err != nil {
t.Fatal(err)
}
issues := strings.Split(string(b), "\n")
t.Log(issues)
require.Contains(t, issues, "#1 test issue for lab list")
}
func Test_issueListFlagLabel(t *testing.T) {
t.Parallel()
repo := copyTestRepo(t)
cmd := exec.Command(labBinaryPath, "issue", "list", "-l", "enhancement")
cmd.Dir = repo
b, err := cmd.CombinedOutput()
if err != nil {
t.Fatal(err)
}
issues := strings.Split(string(b), "\n")
t.Log(issues)
require.Contains(t, issues, "#3 test filter labels 1")
}
func Test_issueListStateClosed(t *testing.T) {
t.Parallel()
repo := copyTestRepo(t)
cmd := exec.Command(labBinaryPath, "issue", "list", "-s", "closed")
cmd.Dir = repo
b, err := cmd.CombinedOutput()
if err != nil {
t.Fatal(err)
}
issues := strings.Split(string(b), "\n")
t.Log(issues)
require.Contains(t, issues, "#4 test closed issue")
}
func Test_issueListSearch(t *testing.T) {
t.Parallel()
repo := copyTestRepo(t)
cmd := exec.Command(labBinaryPath, "issue", "list", "filter labels")
cmd.Dir = repo
b, err := cmd.CombinedOutput()
if err != nil {
t.Fatal(err)
}
issues := strings.Split(string(b), "\n")
t.Log(issues)
require.Contains(t, issues, "#3 test filter labels 1")
require.NotContains(t, issues, "#1 test issue for lab list")
}