MCPcopy Create free account
hub / github.com/cli/cli / Test_findInputs

Function Test_findInputs

pkg/cmd/workflow/run/run_test.go:214–319  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

212}
213
214func Test_findInputs(t *testing.T) {
215 tests := []struct {
216 name string
217 YAML []byte
218 wantErr bool
219 errMsg string
220 wantOut []WorkflowInput
221 }{
222 {
223 name: "blank",
224 YAML: []byte{},
225 wantErr: true,
226 errMsg: "invalid YAML file",
227 },
228 {
229 name: "no event specified",
230 YAML: []byte("name: workflow"),
231 wantErr: true,
232 errMsg: "invalid workflow: no 'on' key",
233 },
234 {
235 name: "not workflow_dispatch",
236 YAML: []byte("name: workflow\non: pull_request"),
237 wantErr: true,
238 errMsg: "unable to manually run a workflow without a workflow_dispatch event",
239 },
240 {
241 name: "bad inputs",
242 YAML: []byte("name: workflow\non:\n workflow_dispatch:\n inputs: lol "),
243 wantErr: true,
244 errMsg: "could not decode workflow inputs: yaml: unmarshal errors:\n line 4: cannot unmarshal !!str `lol` into map[string]run.WorkflowInput",
245 },
246 {
247 name: "short syntax",
248 YAML: []byte("name: workflow\non: workflow_dispatch"),
249 wantOut: []WorkflowInput{},
250 },
251 {
252 name: "array of events",
253 YAML: []byte("name: workflow\non: [pull_request, workflow_dispatch]\n"),
254 wantOut: []WorkflowInput{},
255 },
256 {
257 name: "inputs",
258 YAML: []byte(`name: workflow
259on:
260 workflow_dispatch:
261 inputs:
262 foo:
263 required: true
264 description: good foo
265 bar:
266 default: boo
267 baz:
268 description: it's baz
269 quux:
270 required: true
271 default: "cool"

Callers

nothing calls this directly

Calls 4

findInputsFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…