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

Function TestAddResolvedWorkflows

pkg/cli/add_command_test.go:134–181  ·  view source on GitHub ↗

TestAddCommandStructure removed - redundant with TestNewAddCommand

(t *testing.T)

Source from the content-addressed store, hash-verified

132// TestAddCommandStructure removed - redundant with TestNewAddCommand
133
134func 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
183func TestAddWorkflowsResult(t *testing.T) {
184 tests := []struct {

Callers

nothing calls this directly

Calls 4

AddResolvedWorkflowsFunction · 0.85
BackgroundMethod · 0.80
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected