initTempFlowRoot points FLOW_ROOT at a tempdir AND redirects $HOME so skill install lands inside the tempdir as well. Isolates every init test from the real ~/.flow/ and ~/.claude/skills/. Named with an `init` prefix to avoid colliding with withTempFlowRoot defined in cmd_show_test.go (which has a d
(t *testing.T)
| 13 | // to avoid colliding with withTempFlowRoot defined in cmd_show_test.go |
| 14 | // (which has a different signature because it returns (root, db)). |
| 15 | func initTempFlowRoot(t *testing.T) string { |
| 16 | t.Helper() |
| 17 | root := t.TempDir() |
| 18 | home := t.TempDir() |
| 19 | |
| 20 | oldRoot := os.Getenv("FLOW_ROOT") |
| 21 | oldHome := os.Getenv("HOME") |
| 22 | os.Setenv("FLOW_ROOT", root) |
| 23 | os.Setenv("HOME", home) |
| 24 | t.Cleanup(func() { |
| 25 | os.Setenv("FLOW_ROOT", oldRoot) |
| 26 | os.Setenv("HOME", oldHome) |
| 27 | }) |
| 28 | return root |
| 29 | } |
| 30 | |
| 31 | func TestCmdInitCreatesTree(t *testing.T) { |
| 32 | root := initTempFlowRoot(t) |
no outgoing calls
no test coverage detected