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

Function TestStoreRoundTrip

internal/entities/entities_test.go:13–49  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestStoreRoundTrip(t *testing.T) {
14 home := t.TempDir()
15 t.Setenv("HOME", home)
16 t.Setenv("CAM_CONFIG_DIR", filepath.Join(home, "cfg"))
17
18 store := entities.NewStore(entities.KindInstruction)
19 if err := store.Put(entities.Entity{Name: "demo", Content: "Hello", Apps: []string{"claude"}}); err != nil {
20 t.Fatalf("Put err = %v", err)
21 }
22 all, err := store.All()
23 if err != nil {
24 t.Fatalf("All err = %v", err)
25 }
26 if len(all) != 1 || all[0].Name != "demo" {
27 t.Fatalf("All = %v", all)
28 }
29 got, err := store.Get("demo")
30 if err != nil {
31 t.Fatalf("Get err = %v", err)
32 }
33 if got.Content != "Hello" {
34 t.Fatalf("content = %q", got.Content)
35 }
36 if got.Kind != entities.KindInstruction {
37 t.Fatalf("kind = %q", got.Kind)
38 }
39 if got.UpdatedAt.IsZero() {
40 t.Fatal("UpdatedAt should be set")
41 }
42 removed, err := store.Delete("demo")
43 if err != nil || !removed {
44 t.Fatalf("Delete = %v, %v", removed, err)
45 }
46 if all, _ := store.All(); len(all) != 0 {
47 t.Fatalf("post-delete all = %v", all)
48 }
49}
50
51func TestInstallPromptWritesFile(t *testing.T) {
52 home := t.TempDir()

Callers

nothing calls this directly

Calls 5

PutMethod · 0.95
AllMethod · 0.95
GetMethod · 0.95
DeleteMethod · 0.95
NewStoreFunction · 0.92

Tested by

no test coverage detected