MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / newTestStore

Function newTestStore

internal/instructions/store_test.go:13–25  ·  view source on GitHub ↗

newTestStore returns a Store backed by a temp cam.db with CAM_CONFIG_DIR and HOME isolated to temp directories so managed files and user-level install paths never touch the real home.

(t *testing.T)

Source from the content-addressed store, hash-verified

11// HOME isolated to temp directories so managed files and user-level install
12// paths never touch the real home.
13func newTestStore(t *testing.T) *Store {
14 t.Helper()
15 cfg := t.TempDir()
16 home := t.TempDir()
17 t.Setenv("CAM_CONFIG_DIR", cfg)
18 t.Setenv("HOME", home)
19 t.Setenv("USERPROFILE", home)
20 s := New(filepath.Join(cfg, "cam.db"))
21 if err := s.Init(context.Background()); err != nil {
22 t.Fatalf("Init: %v", err)
23 }
24 return s
25}
26
27func TestCRUDRoundTrip(t *testing.T) {
28 ctx := context.Background()

Callers 14

TestCRUDRoundTripFunction · 0.85
TestDuplicateNameFunction · 0.85
TestInvalidNameFunction · 0.85
TestGetNotFoundFunction · 0.85
TestSymlinkInstallFunction · 0.85
TestCopyFallbackFunction · 0.85
TestConflictTargetExistsFunction · 0.85
TestProjectLevelInstallFunction · 0.85
TestProjectDirRequiredFunction · 0.85

Calls 2

NewFunction · 0.70
InitMethod · 0.45

Tested by

no test coverage detected