TestUpdateWorkflows_CustomDirectory tests that UpdateWorkflows respects custom directory parameter
(t *testing.T)
| 494 | |
| 495 | // TestUpdateWorkflows_CustomDirectory tests that UpdateWorkflows respects custom directory parameter |
| 496 | func TestUpdateWorkflows_CustomDirectory(t *testing.T) { |
| 497 | // Create a temporary directory structure |
| 498 | tmpDir := testutil.TempDir(t, "test-*") |
| 499 | customWorkflowDir := filepath.Join(tmpDir, "custom", "workflows") |
| 500 | if err := os.MkdirAll(customWorkflowDir, 0755); err != nil { |
| 501 | t.Fatalf("Failed to create custom workflow directory: %v", err) |
| 502 | } |
| 503 | |
| 504 | // Create a workflow file with source field |
| 505 | workflowContent := `--- |
| 506 | on: push |
| 507 | engine: claude |
| 508 | source: test/repo/workflow.md@v1.0.0 |
| 509 | --- |
| 510 | |
| 511 | # Test Workflow |
| 512 | |
| 513 | Test content.` |
| 514 | |
| 515 | workflowPath := filepath.Join(customWorkflowDir, "test-workflow.md") |
| 516 | if err := os.WriteFile(workflowPath, []byte(workflowContent), 0644); err != nil { |
| 517 | t.Fatalf("Failed to write workflow file: %v", err) |
| 518 | } |
| 519 | |
| 520 | // Test that findWorkflowsWithSource can find workflows in custom directory |
| 521 | workflows, err := findWorkflowsWithSource(customWorkflowDir, nil, false) |
| 522 | if err != nil { |
| 523 | t.Fatalf("Expected no error finding workflows, got: %v", err) |
| 524 | } |
| 525 | |
| 526 | if len(workflows) == 0 { |
| 527 | t.Fatal("Expected to find at least one workflow") |
| 528 | } |
| 529 | |
| 530 | // Verify the workflow was found in the custom directory |
| 531 | if !strings.Contains(workflows[0].Path, customWorkflowDir) { |
| 532 | t.Errorf("Expected workflow path to contain custom directory '%s', got '%s'", customWorkflowDir, workflows[0].Path) |
| 533 | } |
| 534 | } |
| 535 | |
| 536 | // TestShowUpdateSummary tests the update summary display |
| 537 | func TestShowUpdateSummary(t *testing.T) { |
nothing calls this directly
no test coverage detected