MCPcopy Create free account
hub / github.com/github/gh-aw / TestGetWorkflowStatuses_WithPattern

Function TestGetWorkflowStatuses_WithPattern

pkg/cli/status_mcp_integration_test.go:46–78  ·  view source on GitHub ↗

TestGetWorkflowStatuses_WithPattern tests filtering by pattern

(t *testing.T)

Source from the content-addressed store, hash-verified

44
45// TestGetWorkflowStatuses_WithPattern tests filtering by pattern
46func TestGetWorkflowStatuses_WithPattern(t *testing.T) {
47 // Get all statuses first
48 allStatuses, err := GetWorkflowStatuses("", "", "", "")
49 if err != nil {
50 t.Skipf("Skipping test: not in a repository with workflows: %v", err)
51 return
52 }
53
54 if len(allStatuses) == 0 {
55 t.Skip("Skipping test: no workflows found")
56 return
57 }
58
59 // Use the first workflow's name as a pattern
60 firstWorkflowName := allStatuses[0].Workflow
61 pattern := firstWorkflowName[:min(3, len(firstWorkflowName))] // Use first 3 chars as pattern
62
63 // Get filtered statuses
64 filteredStatuses, err := GetWorkflowStatuses(pattern, "", "", "")
65 require.NoError(t, err, "GetWorkflowStatuses with pattern should not error")
66
67 // Verify that filtered results are a subset
68 assert.LessOrEqual(t, len(filteredStatuses), len(allStatuses),
69 "Filtered results should be <= all results")
70
71 // Verify that all filtered results contain the pattern
72 for _, status := range filteredStatuses {
73 assert.Contains(t, status.Workflow, pattern,
74 "Filtered workflow should contain pattern")
75 }
76
77 t.Logf("Pattern '%s' matched %d of %d workflows", pattern, len(filteredStatuses), len(allStatuses))
78}
79
80// TestGetWorkflowStatuses_MCPJSONStructure verifies the JSON structure
81func TestGetWorkflowStatuses_MCPJSONStructure(t *testing.T) {

Callers

nothing calls this directly

Calls 1

GetWorkflowStatusesFunction · 0.85

Tested by

no test coverage detected