(t *testing.T)
| 185 | } |
| 186 | |
| 187 | func TestResolveWorkflowName_MissingNameField(t *testing.T) { |
| 188 | workflowsDir := setupWorkflowDir(t) |
| 189 | |
| 190 | // Create workflow with valid YAML but missing name field |
| 191 | mdFile := filepath.Join(workflowsDir, "no-name.md") |
| 192 | lockFile := filepath.Join(workflowsDir, "no-name.lock.yml") |
| 193 | |
| 194 | require.NoError(t, os.WriteFile(mdFile, []byte("# No Name\nSome content"), 0644), "failed to write workflow markdown file") |
| 195 | require.NoError(t, os.WriteFile(lockFile, []byte("on: push\njobs: {}\n"), 0644), "failed to write lock file without name field") |
| 196 | |
| 197 | // Test that it returns an error when name field is missing |
| 198 | _, err := ResolveWorkflowName("no-name") |
| 199 | require.Error(t, err, "ResolveWorkflowName should return an error when name field is missing") |
| 200 | assert.Contains(t, err.Error(), "workflow name not found", "error should mention missing workflow name") |
| 201 | } |
| 202 | |
| 203 | func TestResolveWorkflowName_ExistingAgenticWorkflow(t *testing.T) { |
| 204 | // The test is run from the project root where go.mod is located. |
nothing calls this directly
no test coverage detected