MCPcopy Create free account
hub / github.com/diillson/chatcli / newInfoFixture

Function newInfoFixture

cli/skill_handler_info_test.go:29–42  ·  view source on GitHub ↗

newInfoFixture builds a SkillHandler whose registry install dir is a temp directory we control. Returns (handler, installDir). Tests can pre-populate installDir with skill packages and then call sh.Info.

(t *testing.T)

Source from the content-addressed store, hash-verified

27// temp directory we control. Returns (handler, installDir). Tests can
28// pre-populate installDir with skill packages and then call sh.Info.
29func newInfoFixture(t *testing.T) (*SkillHandler, string) {
30 t.Helper()
31 tmp := t.TempDir()
32 t.Setenv("CHATCLI_SKILL_INSTALL_DIR", tmp)
33 mgr := persona.NewManager(zap.NewNop())
34 sh := NewSkillHandler(zap.NewNop(), mgr)
35 if sh.registryMgr == nil {
36 t.Fatal("registryMgr unexpectedly nil after NewSkillHandler")
37 }
38 if got := sh.registryMgr.GetInstallDir(); got != tmp {
39 t.Fatalf("registry install dir = %q, want %q (env override not honored)", got, tmp)
40 }
41 return sh, tmp
42}
43
44func writeInstalledSkill(t *testing.T, installDir, qualifiedName, body string) {
45 t.Helper()

Calls 3

NewManagerFunction · 0.92
NewSkillHandlerFunction · 0.85
GetInstallDirMethod · 0.45

Tested by

no test coverage detected