MCPcopy
hub / github.com/cli/cli / TestNewCmdIssues

Function TestNewCmdIssues

pkg/cmd/search/issues/issues_test.go:15–194  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

13)
14
15func TestNewCmdIssues(t *testing.T) {
16 var trueBool = true
17 tests := []struct {
18 name string
19 input string
20 output shared.IssuesOptions
21 wantErr bool
22 errMsg string
23 }{
24 {
25 name: "no arguments",
26 input: "",
27 wantErr: true,
28 errMsg: "specify search keywords or flags",
29 },
30 {
31 name: "keyword arguments",
32 input: "some search terms",
33 output: shared.IssuesOptions{
34 Query: search.Query{
35 Keywords: []string{"some", "search", "terms"},
36 Kind: "issues",
37 Limit: 30,
38 Qualifiers: search.Qualifiers{Type: "issue"},
39 },
40 },
41 },
42 {
43 name: "web flag",
44 input: "--web",
45 output: shared.IssuesOptions{
46 Query: search.Query{
47 Keywords: []string{},
48 Kind: "issues",
49 Limit: 30,
50 Qualifiers: search.Qualifiers{Type: "issue"},
51 },
52 WebMode: true,
53 },
54 },
55 {
56 name: "limit flag",
57 input: "--limit 10",
58 output: shared.IssuesOptions{
59 Query: search.Query{
60 Keywords: []string{},
61 Kind: "issues",
62 Limit: 10,
63 Qualifiers: search.Qualifiers{Type: "issue"},
64 },
65 },
66 },
67 {
68 name: "invalid limit flag",
69 input: "--limit 1001",
70 wantErr: true,
71 errMsg: "`--limit` must be between 1 and 1000",
72 },

Callers

nothing calls this directly

Calls 4

TestFunction · 0.92
NewCmdIssuesFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected