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

Function TestUpdateWorkflows_CustomDirectory

pkg/cli/update_command_test.go:496–534  ·  view source on GitHub ↗

TestUpdateWorkflows_CustomDirectory tests that UpdateWorkflows respects custom directory parameter

(t *testing.T)

Source from the content-addressed store, hash-verified

494
495// TestUpdateWorkflows_CustomDirectory tests that UpdateWorkflows respects custom directory parameter
496func 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 := `---
506on: push
507engine: claude
508source: test/repo/workflow.md@v1.0.0
509---
510
511# Test Workflow
512
513Test 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
537func TestShowUpdateSummary(t *testing.T) {

Callers

nothing calls this directly

Calls 3

TempDirFunction · 0.92
findWorkflowsWithSourceFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected