MCPcopy
hub / github.com/cli/cli / Test_NewCmdList

Function Test_NewCmdList

pkg/cmd/release/list/list_test.go:22–117  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

20)
21
22func Test_NewCmdList(t *testing.T) {
23 tests := []struct {
24 name string
25 args string
26 isTTY bool
27 want ListOptions
28 wantErr string
29 }{
30 {
31 name: "no arguments",
32 args: "",
33 isTTY: true,
34 want: ListOptions{
35 LimitResults: 30,
36 ExcludeDrafts: false,
37 ExcludePreReleases: false,
38 Order: "desc",
39 },
40 },
41 {
42 name: "exclude drafts",
43 args: "--exclude-drafts",
44 want: ListOptions{
45 LimitResults: 30,
46 ExcludeDrafts: true,
47 ExcludePreReleases: false,
48 Order: "desc",
49 },
50 },
51 {
52 name: "exclude pre-releases",
53 args: "--exclude-pre-releases",
54 want: ListOptions{
55 LimitResults: 30,
56 ExcludeDrafts: false,
57 ExcludePreReleases: true,
58 Order: "desc",
59 },
60 },
61 {
62 name: "zero limit",
63 args: "--limit 0",
64 wantErr: "invalid limit: 0",
65 },
66 {
67 name: "with order",
68 args: "--order asc",
69 want: ListOptions{
70 LimitResults: 30,
71 ExcludeDrafts: false,
72 ExcludePreReleases: false,
73 Order: "asc",
74 },
75 },
76 }
77 for _, tt := range tests {
78 t.Run(tt.name, func(t *testing.T) {
79 ios, _, _, _ := iostreams.Test()

Callers

nothing calls this directly

Calls 7

TestFunction · 0.92
SetStdoutTTYMethod · 0.80
SetStdinTTYMethod · 0.80
SetStderrTTYMethod · 0.80
EqualMethod · 0.80
NewCmdListFunction · 0.70
RunMethod · 0.65

Tested by

no test coverage detected