MCPcopy Index your code
hub / github.com/cli/cli / TestListRun

Function TestListRun

pkg/cmd/workflow/list/list_test.go:89–229  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

87}
88
89func TestListRun(t *testing.T) {
90 workflows := []shared.Workflow{
91 {
92 Name: "Go",
93 State: shared.Active,
94 ID: 707,
95 },
96 {
97 Name: "Linter",
98 State: shared.Active,
99 ID: 666,
100 },
101 {
102 Name: "Release",
103 State: shared.DisabledManually,
104 ID: 451,
105 },
106 }
107 payload := shared.WorkflowsPayload{Workflows: workflows}
108
109 tests := []struct {
110 name string
111 opts *ListOptions
112 wantErr bool
113 wantOut string
114 wantErrOut string
115 stubs func(*httpmock.Registry)
116 tty bool
117 }{
118 {
119 name: "lists worrkflows nontty",
120 opts: &ListOptions{
121 Limit: defaultLimit,
122 },
123 wantOut: "Go\tactive\t707\nLinter\tactive\t666\n",
124 },
125 {
126 name: "lists workflows tty",
127 opts: &ListOptions{
128 Limit: defaultLimit,
129 },
130 tty: true,
131 wantOut: "NAME STATE ID\nGo active 707\nLinter active 666\n",
132 },
133 {
134 name: "lists workflows with limit tty",
135 opts: &ListOptions{
136 Limit: 1,
137 },
138 tty: true,
139 wantOut: "NAME STATE ID\nGo active 707\n",
140 },
141 {
142 name: "show all workflows tty",
143 opts: &ListOptions{
144 Limit: defaultLimit,
145 All: true,
146 },

Callers

nothing calls this directly

Calls 12

RegisterMethod · 0.95
VerifyMethod · 0.95
RESTFunction · 0.92
JSONResponseFunction · 0.92
TestFunction · 0.92
FromFullNameFunction · 0.92
SetStdoutTTYMethod · 0.80
EqualMethod · 0.80
listRunFunction · 0.70
RunMethod · 0.65
ErrorMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected