MCPcopy Index your code
hub / github.com/docker/docker-agent / TestAddMemory

Function TestAddMemory

pkg/memory/database/sqlite/sqlite_test.go:47–73  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

45}
46
47func TestAddMemory(t *testing.T) {
48 t.Parallel()
49 db := setupTestDB(t)
50
51 ctx := t.Context()
52
53 memory := database.UserMemory{
54 ID: "test-id-1",
55 CreatedAt: time.Now().Format(time.RFC3339),
56 Memory: "Test memory content",
57 }
58
59 err := db.AddMemory(ctx, memory)
60 require.NoError(t, err, "Adding memory should succeed")
61
62 err = db.AddMemory(ctx, memory)
63 require.Error(t, err, "Adding memory with duplicate ID should fail")
64
65 emptyIDMemory := database.UserMemory{
66 ID: "",
67 CreatedAt: time.Now().Format(time.RFC3339),
68 Memory: "Empty ID memory",
69 }
70
71 err = db.AddMemory(ctx, emptyIDMemory)
72 require.Error(t, err, "Adding memory with empty ID should fail")
73}
74
75func TestAddMemoryWithCategory(t *testing.T) {
76 t.Parallel()

Callers

nothing calls this directly

Calls 5

setupTestDBFunction · 0.85
ContextMethod · 0.80
NowMethod · 0.80
AddMemoryMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected