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:
@@ -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 () => {
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user