github.com/zaquestion/lab@v0.25.1/cmd/milestone_list_test.go (about) 1 package cmd 2 3 import ( 4 "os/exec" 5 "strings" 6 "testing" 7 8 "github.com/stretchr/testify/require" 9 ) 10 11 func Test_milestoneList(t *testing.T) { 12 t.Parallel() 13 repo := copyTestRepo(t) 14 cmd := exec.Command(labBinaryPath, "milestone", "list") 15 cmd.Dir = repo 16 17 b, err := cmd.CombinedOutput() 18 if err != nil { 19 t.Fatal(err) 20 } 21 22 milestones := strings.Split(string(b), "\n") 23 t.Log(milestones) 24 require.Contains(t, milestones, "1.0") 25 } 26 27 func Test_milestoneListSearch(t *testing.T) { 28 t.Parallel() 29 repo := copyTestRepo(t) 30 cmd := exec.Command(labBinaryPath, "milestone", "list", "99") 31 cmd.Dir = repo 32 33 b, err := cmd.CombinedOutput() 34 if err != nil { 35 t.Fatal(err) 36 } 37 38 milestones := strings.Split(string(b), "\n") 39 t.Log(milestones) 40 require.NotContains(t, milestones, "1.0") 41 } 42 43 func Test_milestoneListState(t *testing.T) { 44 t.Parallel() 45 repo := copyTestRepo(t) 46 cmd := exec.Command(labBinaryPath, "milestone", "list", "--state", "closed") 47 cmd.Dir = repo 48 49 b, err := cmd.CombinedOutput() 50 if err != nil { 51 t.Fatal(err) 52 } 53 54 milestones := strings.Split(string(b), "\n") 55 t.Log(milestones) 56 require.NotContains(t, milestones, "1.0") 57 }