From 2a5ffd097628deb32b89b3c62f12d9873f8a632b Mon Sep 17 00:00:00 2001 From: Soumil Rathi Date: Mon, 13 Apr 2026 13:45:12 -0700 Subject: [PATCH] fix: update integration tests for v3 API responses - crud.test.ts: add() returns {event_id, status} not an array - search.test.ts: use snake_case user_id in filters for v3 compatibility Co-Authored-By: Claude Opus 4.6 (1M context) --- .../src/client/tests/integration/crud.test.ts | 17 +++++------------ .../src/client/tests/integration/search.test.ts | 2 +- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/mem0-ts/src/client/tests/integration/crud.test.ts b/mem0-ts/src/client/tests/integration/crud.test.ts index 134ba1c7e..bbcee3427 100644 --- a/mem0-ts/src/client/tests/integration/crud.test.ts +++ b/mem0-ts/src/client/tests/integration/crud.test.ts @@ -53,15 +53,9 @@ describeIntegration("MemoryClient Integration — CRUD", () => { const result = await client.add(messages, { userId: TEST_USER_ID }); - // API processes memories asynchronously — returns PENDING - expect(Array.isArray(result)).toBe(true); - expect(result.length).toBeGreaterThan(0); - - // Validate response shape - for (const item of result) { - expect(item).toHaveProperty("status"); - expect(item).toHaveProperty("eventId"); - } + // v3 API processes memories asynchronously — returns PENDING + expect(result).toHaveProperty("event_id"); + expect(result).toHaveProperty("status"); }); test("adds a second batch of messages", async () => { @@ -77,7 +71,7 @@ describeIntegration("MemoryClient Integration — CRUD", () => { ]; const result = await client.add(messages, { userId: TEST_USER_ID }); - expect(Array.isArray(result)).toBe(true); + expect(result).toHaveProperty("event_id"); }); test("memories become available after async processing", async () => { @@ -196,8 +190,7 @@ describeIntegration("MemoryClient Integration — CRUD", () => { }, ); - expect(Array.isArray(result)).toBe(true); - expect(result.length).toBeGreaterThan(0); + expect(result).toHaveProperty("event_id"); }); test("getAll for non-existent user returns empty array", async () => { diff --git a/mem0-ts/src/client/tests/integration/search.test.ts b/mem0-ts/src/client/tests/integration/search.test.ts index 3e5f3f3b7..c679d4d75 100644 --- a/mem0-ts/src/client/tests/integration/search.test.ts +++ b/mem0-ts/src/client/tests/integration/search.test.ts @@ -109,7 +109,7 @@ describeIntegration("MemoryClient Integration — Search & History", () => { describe("edge cases", () => { test("search for non-existent user returns empty results", async () => { const response = await client.search("anything", { - filters: { userId: `nonexistent-user-${randomUUID()}` }, + filters: { user_id: `nonexistent-user-${randomUUID()}` }, }); expect(response).toHaveProperty("results");