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

Function TestAppStateKeyValue

internal/appstate/store_test.go:67–85  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

65}
66
67func TestAppStateKeyValue(t *testing.T) {
68 ctx := context.Background()
69 store := New(filepath.Join(t.TempDir(), "cam.db"))
70 want := map[string]any{"sidebar": "wide"}
71 if err := store.SetState(ctx, "ui", want); err != nil {
72 t.Fatalf("SetState: %v", err)
73 }
74 var got map[string]any
75 ok, err := store.GetState(ctx, "ui", &got)
76 if err != nil {
77 t.Fatalf("GetState: %v", err)
78 }
79 if !ok || got["sidebar"] != "wide" {
80 t.Fatalf("state = ok:%v value:%+v", ok, got)
81 }
82 if _, err := os.Stat(store.Path()); err != nil {
83 t.Fatalf("db file missing: %v", err)
84 }
85}
86
87// TestInitCreatesInstructionTablesWithoutLosingData verifies that opening a
88// cam.db created before the instructions feature lands adds the new tables

Callers

nothing calls this directly

Calls 4

SetStateMethod · 0.80
GetStateMethod · 0.80
NewFunction · 0.70
PathMethod · 0.45

Tested by

no test coverage detected