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

Function TestInitRepositoryWithNoAgent

pkg/cli/init_command_test.go:408–444  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

406}
407
408func TestInitRepositoryWithNoAgent(t *testing.T) {
409 tmpDir := testutil.TempDir(t, "test-*")
410
411 originalDir, err := os.Getwd()
412 if err != nil {
413 t.Fatalf("Failed to get current directory: %v", err)
414 }
415 defer func() {
416 _ = os.Chdir(originalDir)
417 }()
418
419 if err := os.Chdir(tmpDir); err != nil {
420 t.Fatalf("Failed to change to temp directory: %v", err)
421 }
422
423 if err := exec.Command("git", "init").Run(); err != nil {
424 t.Skip("Git not available")
425 }
426
427 _ = exec.Command("git", "config", "user.name", "Test User").Run()
428 _ = exec.Command("git", "config", "user.email", "test@example.com").Run()
429
430 err = InitRepository(InitOptions{Verbose: false, Skill: true, Agent: false, MCP: true, CodespaceRepos: []string{}, CodespaceEnabled: false, Completions: false, CreatePR: false, RootCmd: nil})
431 if err != nil {
432 t.Fatalf("InitRepository() with no agent failed: %v", err)
433 }
434
435 if _, err := os.Stat(filepath.Join(".github", "skills", "agentic-workflows", "SKILL.md")); os.IsNotExist(err) {
436 t.Error("Expected dispatcher skill file to still be created with agent disabled")
437 }
438 if _, err := os.Stat(filepath.Join(".github", "skills", "agentic-workflow-designer", "SKILL.md")); os.IsNotExist(err) {
439 t.Error("Expected workflow designer skill file to still be created with agent disabled")
440 }
441 if _, err := os.Stat(filepath.Join(".github", "agents", "agentic-workflows.md")); err == nil {
442 t.Error("Expected Agentic Workflows custom agent file to NOT be created with agent disabled")
443 }
444}
445
446func TestInitRepositoryWithNonCopilotEngineSkipsCopilotArtifacts(t *testing.T) {
447 tmpDir := testutil.TempDir(t, "test-*")

Callers

nothing calls this directly

Calls 4

TempDirFunction · 0.92
InitRepositoryFunction · 0.85
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected