(t *testing.T)
| 16 | ) |
| 17 | |
| 18 | func 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 | |
| 48 | func TestWorkflowListItem_JSONMarshaling(t *testing.T) { |
| 49 | // Test that WorkflowListItem can be marshaled to JSON |
nothing calls this directly
no test coverage detected