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

Function TestWorkflowRunIDFromOutput

acceptance/acceptance_test.go:314–349  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

312}
313
314func TestWorkflowRunIDFromOutput(t *testing.T) {
315 tests := []struct {
316 name string
317 output string
318 want string
319 }{
320 {
321 name: "GitHub.com workflow run URL",
322 output: "https://github.com/OWNER/REPO/actions/runs/1234\n",
323 want: "1234",
324 },
325 {
326 name: "GHEC workflow run URL",
327 output: "https://example.ghe.com/OWNER/REPO/actions/runs/5678\n",
328 want: "5678",
329 },
330 {
331 name: "empty legacy dispatch output",
332 output: "",
333 },
334 {
335 name: "unrelated URL",
336 output: "https://github.com/OWNER/REPO/actions/workflows/main.yml",
337 },
338 {
339 name: "non-numeric run identifier",
340 output: "https://github.com/OWNER/REPO/actions/runs/latest",
341 },
342 }
343
344 for _, tt := range tests {
345 t.Run(tt.name, func(t *testing.T) {
346 assert.Equal(t, tt.want, workflowRunIDFromOutput(tt.output))
347 })
348 }
349}
350
351func TestResolveWorkflowRunIDUsesDispatchOutput(t *testing.T) {
352 runID, err := resolveWorkflowRunID(

Callers

nothing calls this directly

Calls 3

workflowRunIDFromOutputFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected