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

Function TestRunListWorkflows_JSONOutput

pkg/cli/list_workflows_command_test.go:18–46  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

16)
17
18func TestRunListWorkflows_JSONOutput(t *testing.T) {
19 // Save current directory
20 originalDir, err := os.Getwd()
21 require.NoError(t, err, "Failed to get current directory")
22
23 // Change to repository root
24 repoRoot := filepath.Join(originalDir, "..", "..")
25 err = os.Chdir(repoRoot)
26 require.NoError(t, err, "Failed to change to repository root")
27 defer os.Chdir(originalDir)
28
29 // Test JSON output without pattern
30 t.Run("JSON output without pattern", func(t *testing.T) {
31 err := RunListWorkflows("", ".github/workflows", "", false, true, "")
32 assert.NoError(t, err, "RunListWorkflows with JSON flag should not error")
33 })
34
35 // Test JSON output with pattern
36 t.Run("JSON output with pattern", func(t *testing.T) {
37 err := RunListWorkflows("", ".github/workflows", "smoke", false, true, "")
38 assert.NoError(t, err, "RunListWorkflows with JSON flag and pattern should not error")
39 })
40
41 // Test JSON output with label filter
42 t.Run("JSON output with label filter", func(t *testing.T) {
43 err := RunListWorkflows("", ".github/workflows", "", false, true, "test")
44 assert.NoError(t, err, "RunListWorkflows with JSON flag and label filter should not error")
45 })
46}
47
48func TestWorkflowListItem_JSONMarshaling(t *testing.T) {
49 // Test that WorkflowListItem can be marshaled to JSON

Callers

nothing calls this directly

Calls 2

RunListWorkflowsFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected