MCPcopy Create free account
hub / github.com/Facets-cloud/flow / initTempFlowRoot

Function initTempFlowRoot

internal/app/init_test.go:15–29  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

13// to avoid colliding with withTempFlowRoot defined in cmd_show_test.go
14// (which has a different signature because it returns (root, db)).
15func 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
31func TestCmdInitCreatesTree(t *testing.T) {
32 root := initTempFlowRoot(t)

Callers 8

setupFlowRootFunction · 0.85
TestCmdInitCreatesTreeFunction · 0.85
TestCmdInitIdempotentFunction · 0.85
TestCmdInitInstallsSkillFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected