TestAddCommandStructure removed - redundant with TestNewAddCommand
(t *testing.T)
| 132 | // TestAddCommandStructure removed - redundant with TestNewAddCommand |
| 133 | |
| 134 | func TestAddResolvedWorkflows(t *testing.T) { |
| 135 | tests := []struct { |
| 136 | name string |
| 137 | expectError bool |
| 138 | errorContains string |
| 139 | }{ |
| 140 | { |
| 141 | name: "valid workflow", |
| 142 | expectError: true, // Will still error due to missing git repo, but validates basic flow |
| 143 | }, |
| 144 | } |
| 145 | |
| 146 | for _, tt := range tests { |
| 147 | t.Run(tt.name, func(t *testing.T) { |
| 148 | // Create a minimal resolved workflow structure |
| 149 | resolved := &ResolvedWorkflows{ |
| 150 | Workflows: []*ResolvedWorkflow{ |
| 151 | { |
| 152 | Spec: &WorkflowSpec{ |
| 153 | RepoSpec: RepoSpec{ |
| 154 | RepoSlug: "test/repo", |
| 155 | }, |
| 156 | WorkflowName: "test-workflow", |
| 157 | WorkflowPath: "test.md", |
| 158 | }, |
| 159 | }, |
| 160 | }, |
| 161 | } |
| 162 | |
| 163 | opts := AddOptions{} |
| 164 | _, err := AddResolvedWorkflows( |
| 165 | context.Background(), |
| 166 | []string{"test/repo/test-workflow"}, |
| 167 | resolved, |
| 168 | opts, |
| 169 | ) |
| 170 | |
| 171 | if tt.expectError { |
| 172 | require.Error(t, err, "Expected error for test case: %s", tt.name) |
| 173 | if tt.errorContains != "" { |
| 174 | assert.Contains(t, err.Error(), tt.errorContains, "Error should contain expected message") |
| 175 | } |
| 176 | } else { |
| 177 | assert.NoError(t, err, "Should not error for test case: %s", tt.name) |
| 178 | } |
| 179 | }) |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | func TestAddWorkflowsResult(t *testing.T) { |
| 184 | tests := []struct { |
nothing calls this directly
no test coverage detected