(t *testing.T)
| 92 | } |
| 93 | |
| 94 | func TestAddWorkflows(t *testing.T) { |
| 95 | tests := []struct { |
| 96 | name string |
| 97 | workflows []string |
| 98 | expectError bool |
| 99 | errorContains string |
| 100 | }{ |
| 101 | { |
| 102 | name: "empty workflows list", |
| 103 | workflows: []string{}, |
| 104 | expectError: true, |
| 105 | errorContains: "at least one workflow", |
| 106 | }, |
| 107 | { |
| 108 | name: "invalid repo spec missing repo name", |
| 109 | workflows: []string{"owner"}, |
| 110 | expectError: true, |
| 111 | errorContains: "not a valid workflow path or repository package", |
| 112 | }, |
| 113 | } |
| 114 | |
| 115 | for _, tt := range tests { |
| 116 | t.Run(tt.name, func(t *testing.T) { |
| 117 | opts := AddOptions{} |
| 118 | _, err := AddWorkflows(context.Background(), tt.workflows, opts) |
| 119 | |
| 120 | if tt.expectError { |
| 121 | require.Error(t, err, "Expected error for test case: %s", tt.name) |
| 122 | if tt.errorContains != "" { |
| 123 | assert.Contains(t, err.Error(), tt.errorContains, "Error should contain expected message") |
| 124 | } |
| 125 | } else { |
| 126 | assert.NoError(t, err, "Should not error for test case: %s", tt.name) |
| 127 | } |
| 128 | }) |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | // TestAddCommandStructure removed - redundant with TestNewAddCommand |
| 133 |
nothing calls this directly
no test coverage detected