fix: adopt new v3 memory endpoints in Python + TS clients (#4856)
This commit is contained in:
@@ -124,13 +124,16 @@ describeIntegration("MemoryClient Integration — CRUD", () => {
|
||||
filters: { user_id: TEST_USER_ID },
|
||||
});
|
||||
|
||||
// v1.1 output_format returns { results: [...] }
|
||||
// Paginated shape: { count, next, previous, results: [...] }
|
||||
expect(response).toHaveProperty("count");
|
||||
expect(response).toHaveProperty("next");
|
||||
expect(response).toHaveProperty("previous");
|
||||
expect(response).toHaveProperty("results");
|
||||
const memories = (response as any).results;
|
||||
expect(Array.isArray(memories)).toBe(true);
|
||||
expect(memories.length).toBeGreaterThanOrEqual(memoryIds.length);
|
||||
expect(typeof response.count).toBe("number");
|
||||
expect(Array.isArray(response.results)).toBe(true);
|
||||
expect(response.results.length).toBeGreaterThanOrEqual(memoryIds.length);
|
||||
|
||||
for (const mem of memories) {
|
||||
for (const mem of response.results) {
|
||||
expect(typeof mem.id).toBe("string");
|
||||
expect(typeof mem.memory).toBe("string");
|
||||
}
|
||||
@@ -143,9 +146,12 @@ describeIntegration("MemoryClient Integration — CRUD", () => {
|
||||
pageSize: 1,
|
||||
});
|
||||
|
||||
// Paginated response is an object with results array
|
||||
expect(page1).toBeDefined();
|
||||
expect(page1).toHaveProperty("results");
|
||||
expect(page1).toHaveProperty("count");
|
||||
expect(page1).toHaveProperty("next");
|
||||
expect(page1).toHaveProperty("previous");
|
||||
expect(Array.isArray(page1.results)).toBe(true);
|
||||
expect(page1.results.length).toBeLessThanOrEqual(1);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -206,11 +212,10 @@ describeIntegration("MemoryClient Integration — CRUD", () => {
|
||||
filters: { user_id: `nonexistent-user-${randomUUID()}` },
|
||||
});
|
||||
|
||||
// v1.1 output_format returns { results: [...] }
|
||||
expect(response).toHaveProperty("results");
|
||||
const memories = (response as any).results;
|
||||
expect(Array.isArray(memories)).toBe(true);
|
||||
expect(memories.length).toBe(0);
|
||||
expect(Array.isArray(response.results)).toBe(true);
|
||||
expect(response.results.length).toBe(0);
|
||||
expect(response.count).toBe(0);
|
||||
});
|
||||
|
||||
test("deleteAll for non-existent user does not throw", async () => {
|
||||
|
||||
@@ -70,10 +70,7 @@ export async function waitForMemories(
|
||||
const response = await withRetry(() =>
|
||||
client.getAll({ filters: { user_id: userId } }),
|
||||
);
|
||||
// v1.1 output_format returns { results: [...] }
|
||||
const memories = Array.isArray(response)
|
||||
? response
|
||||
: ((response as any)?.results ?? []);
|
||||
const memories = response.results ?? [];
|
||||
if (memories.length >= minCount) {
|
||||
return memories;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user