(t *testing.T)
| 393 | } |
| 394 | |
| 395 | func TestEnsureCopilotSetupStepsDirectoryCreation(t *testing.T) { |
| 396 | tmpDir := testutil.TempDir(t, "test-*") |
| 397 | |
| 398 | originalDir, err := os.Getwd() |
| 399 | if err != nil { |
| 400 | t.Fatalf("Failed to get current directory: %v", err) |
| 401 | } |
| 402 | defer func() { |
| 403 | _ = os.Chdir(originalDir) |
| 404 | }() |
| 405 | |
| 406 | if err := os.Chdir(tmpDir); err != nil { |
| 407 | t.Fatalf("Failed to change to temp directory: %v", err) |
| 408 | } |
| 409 | |
| 410 | // Call function when .github/workflows doesn't exist |
| 411 | err = ensureCopilotSetupSteps(context.Background(), false, workflow.ActionModeDev, "dev") |
| 412 | if err != nil { |
| 413 | t.Fatalf("ensureCopilotSetupSteps(context.Background()) failed: %v", err) |
| 414 | } |
| 415 | |
| 416 | // Verify directory structure was created |
| 417 | workflowsDir := filepath.Join(".github", "workflows") |
| 418 | info, err := os.Stat(workflowsDir) |
| 419 | if os.IsNotExist(err) { |
| 420 | t.Error("Expected .github/workflows directory to be created") |
| 421 | return |
| 422 | } |
| 423 | |
| 424 | if !info.IsDir() { |
| 425 | t.Error("Expected .github/workflows to be a directory") |
| 426 | } |
| 427 | |
| 428 | // Verify file was created |
| 429 | setupStepsPath := filepath.Join(workflowsDir, "copilot-setup-steps.yml") |
| 430 | if _, err := os.Stat(setupStepsPath); os.IsNotExist(err) { |
| 431 | t.Error("Expected copilot-setup-steps.yml to be created") |
| 432 | } |
| 433 | } |
| 434 | |
| 435 | // TestEnsureCopilotSetupSteps_ReleaseMode tests that release mode uses the actions/setup-cli action |
| 436 | func TestEnsureCopilotSetupSteps_ReleaseMode(t *testing.T) { |
nothing calls this directly
no test coverage detected