TestEnsureCopilotSetupSteps_CreateWithDevMode tests creating a new file with dev mode
(t *testing.T)
| 573 | |
| 574 | // TestEnsureCopilotSetupSteps_CreateWithDevMode tests creating a new file with dev mode |
| 575 | func TestEnsureCopilotSetupSteps_CreateWithDevMode(t *testing.T) { |
| 576 | tmpDir := t.TempDir() |
| 577 | originalDir, err := os.Getwd() |
| 578 | if err != nil { |
| 579 | t.Fatalf("Failed to get current directory: %v", err) |
| 580 | } |
| 581 | defer func() { _ = os.Chdir(originalDir) }() |
| 582 | |
| 583 | if err := os.Chdir(tmpDir); err != nil { |
| 584 | t.Fatalf("Failed to change to temp directory: %v", err) |
| 585 | } |
| 586 | |
| 587 | // Create new file with dev mode |
| 588 | err = ensureCopilotSetupSteps(context.Background(), false, workflow.ActionModeDev, "dev") |
| 589 | if err != nil { |
| 590 | t.Fatalf("ensureCopilotSetupSteps(context.Background()) failed: %v", err) |
| 591 | } |
| 592 | |
| 593 | setupStepsPath := filepath.Join(".github", "workflows", "copilot-setup-steps.yml") |
| 594 | content, err := os.ReadFile(setupStepsPath) |
| 595 | if err != nil { |
| 596 | t.Fatalf("Failed to read copilot-setup-steps.yml: %v", err) |
| 597 | } |
| 598 | |
| 599 | contentStr := string(content) |
| 600 | |
| 601 | // Verify dev mode characteristics |
| 602 | if !strings.Contains(contentStr, "curl -fsSL") { |
| 603 | t.Errorf("Expected curl command in dev mode") |
| 604 | } |
| 605 | if !strings.Contains(contentStr, "install-gh-aw.sh") { |
| 606 | t.Errorf("Expected install-gh-aw.sh reference in dev mode") |
| 607 | } |
| 608 | if strings.Contains(contentStr, "actions/setup-cli") { |
| 609 | t.Errorf("Did not expect actions/setup-cli in dev mode") |
| 610 | } |
| 611 | if strings.Contains(contentStr, "actions/checkout") { |
| 612 | t.Errorf("Did not expect checkout step in dev mode") |
| 613 | } |
| 614 | } |
| 615 | |
| 616 | func TestEnsureCopilotSetupSteps_UsesWorkflowDirEnvOverride(t *testing.T) { |
| 617 | tmpDir := t.TempDir() |
nothing calls this directly
no test coverage detected