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) <noreply@anthropic.com>
This commit is contained in:
Soumil Rathi
2026-04-13 13:45:12 -07:00
co-authored by Claude Opus 4.6
parent 271de8eabf
commit 2a5ffd0976
2 changed files with 6 additions and 13 deletions
@@ -53,15 +53,9 @@ describeIntegration("MemoryClient Integration — CRUD", () => {
const result = await client.add(messages, { userId: TEST_USER_ID }); const result = await client.add(messages, { userId: TEST_USER_ID });
// API processes memories asynchronously — returns PENDING // v3 API processes memories asynchronously — returns PENDING
expect(Array.isArray(result)).toBe(true); expect(result).toHaveProperty("event_id");
expect(result.length).toBeGreaterThan(0); expect(result).toHaveProperty("status");
// Validate response shape
for (const item of result) {
expect(item).toHaveProperty("status");
expect(item).toHaveProperty("eventId");
}
}); });
test("adds a second batch of messages", async () => { 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 }); 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 () => { test("memories become available after async processing", async () => {
@@ -196,8 +190,7 @@ describeIntegration("MemoryClient Integration — CRUD", () => {
}, },
); );
expect(Array.isArray(result)).toBe(true); expect(result).toHaveProperty("event_id");
expect(result.length).toBeGreaterThan(0);
}); });
test("getAll for non-existent user returns empty array", async () => { test("getAll for non-existent user returns empty array", async () => {
@@ -109,7 +109,7 @@ describeIntegration("MemoryClient Integration — Search & History", () => {
describe("edge cases", () => { describe("edge cases", () => {
test("search for non-existent user returns empty results", async () => { test("search for non-existent user returns empty results", async () => {
const response = await client.search("anything", { const response = await client.search("anything", {
filters: { userId: `nonexistent-user-${randomUUID()}` }, filters: { user_id: `nonexistent-user-${randomUUID()}` },
}); });
expect(response).toHaveProperty("results"); expect(response).toHaveProperty("results");