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

Function TestInitRepositoryWithNoSkill

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

Source from the content-addressed store, hash-verified

368}
369
370func TestInitRepositoryWithNoSkill(t *testing.T) {
371 tmpDir := testutil.TempDir(t, "test-*")
372
373 originalDir, err := os.Getwd()
374 if err != nil {
375 t.Fatalf("Failed to get current directory: %v", err)
376 }
377 defer func() {
378 _ = os.Chdir(originalDir)
379 }()
380
381 if err := os.Chdir(tmpDir); err != nil {
382 t.Fatalf("Failed to change to temp directory: %v", err)
383 }
384
385 if err := exec.Command("git", "init").Run(); err != nil {
386 t.Skip("Git not available")
387 }
388
389 _ = exec.Command("git", "config", "user.name", "Test User").Run()
390 _ = exec.Command("git", "config", "user.email", "test@example.com").Run()
391
392 err = InitRepository(InitOptions{Verbose: false, Skill: false, Agent: true, MCP: true, CodespaceRepos: []string{}, CodespaceEnabled: false, Completions: false, CreatePR: false, RootCmd: nil})
393 if err != nil {
394 t.Fatalf("InitRepository() with no skill failed: %v", err)
395 }
396
397 if _, err := os.Stat(filepath.Join(".github", "skills", "agentic-workflows", "SKILL.md")); err == nil {
398 t.Error("Expected dispatcher skill file to NOT be created with skill disabled")
399 }
400 if _, err := os.Stat(filepath.Join(".github", "skills", "agentic-workflow-designer", "SKILL.md")); err == nil {
401 t.Error("Expected workflow designer skill file to NOT be created with skill disabled")
402 }
403 if _, err := os.Stat(filepath.Join(".github", "agents", "agentic-workflows.md")); os.IsNotExist(err) {
404 t.Error("Expected Agentic Workflows custom agent file to still be created with skill disabled")
405 }
406}
407
408func TestInitRepositoryWithNoAgent(t *testing.T) {
409 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