(t *testing.T)
| 98 | } |
| 99 | |
| 100 | func TestCmdInitSkipsSkillIfAlreadyPresent(t *testing.T) { |
| 101 | initTempFlowRoot(t) |
| 102 | home := os.Getenv("HOME") |
| 103 | skillPath := filepath.Join(home, ".claude", "skills", "flow", "SKILL.md") |
| 104 | if err := os.MkdirAll(filepath.Dir(skillPath), 0o755); err != nil { |
| 105 | t.Fatal(err) |
| 106 | } |
| 107 | if err := os.WriteFile(skillPath, []byte("existing content"), 0o644); err != nil { |
| 108 | t.Fatal(err) |
| 109 | } |
| 110 | if rc := cmdInit(nil); rc != 0 { |
| 111 | t.Fatalf("cmdInit rc=%d", rc) |
| 112 | } |
| 113 | data, err := os.ReadFile(skillPath) |
| 114 | if err != nil { |
| 115 | t.Fatal(err) |
| 116 | } |
| 117 | if string(data) != "existing content" { |
| 118 | t.Errorf("init overwrote existing skill: %q", string(data)) |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | func TestCmdInitRejectsExtraArgs(t *testing.T) { |
| 123 | initTempFlowRoot(t) |
nothing calls this directly
no test coverage detected