test: update integration tests for v1.1 output_format (#4847)

This commit is contained in:
Kartik
2026-04-16 01:37:51 +05:30
committed by GitHub
parent 86fe275f53
commit 93a51f4763
2 changed files with 16 additions and 5 deletions
@@ -120,10 +120,13 @@ describeIntegration("MemoryClient Integration — CRUD", () => {
// ─── Get all ────────────────────────────────────────────── // ─── Get all ──────────────────────────────────────────────
describe("get all memories", () => { describe("get all memories", () => {
test("returns all memories for test user", async () => { test("returns all memories for test user", async () => {
const memories = await client.getAll({ const response = await client.getAll({
filters: { user_id: TEST_USER_ID }, filters: { user_id: TEST_USER_ID },
}); });
// v1.1 output_format returns { results: [...] }
expect(response).toHaveProperty("results");
const memories = (response as any).results;
expect(Array.isArray(memories)).toBe(true); expect(Array.isArray(memories)).toBe(true);
expect(memories.length).toBeGreaterThanOrEqual(memoryIds.length); expect(memories.length).toBeGreaterThanOrEqual(memoryIds.length);
@@ -142,6 +145,7 @@ describeIntegration("MemoryClient Integration — CRUD", () => {
// Paginated response is an object with results array // Paginated response is an object with results array
expect(page1).toBeDefined(); expect(page1).toBeDefined();
expect(page1).toHaveProperty("results");
}); });
}); });
@@ -197,11 +201,14 @@ describeIntegration("MemoryClient Integration — CRUD", () => {
expect(result).toHaveProperty("eventId"); expect(result).toHaveProperty("eventId");
}); });
test("getAll for non-existent user returns empty array", async () => { test("getAll for non-existent user returns empty results", async () => {
const memories = await client.getAll({ const response = await client.getAll({
filters: { user_id: `nonexistent-user-${randomUUID()}` }, 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(Array.isArray(memories)).toBe(true);
expect(memories.length).toBe(0); expect(memories.length).toBe(0);
}); });
@@ -67,10 +67,14 @@ export async function waitForMemories(
maxRetries = 4, maxRetries = 4,
): Promise<Memory[]> { ): Promise<Memory[]> {
for (let attempt = 1; attempt <= maxRetries; attempt++) { for (let attempt = 1; attempt <= maxRetries; attempt++) {
const memories = await withRetry(() => const response = await withRetry(() =>
client.getAll({ filters: { user_id: userId } }), client.getAll({ filters: { user_id: userId } }),
); );
if (Array.isArray(memories) && memories.length >= minCount) { // v1.1 output_format returns { results: [...] }
const memories = Array.isArray(response)
? response
: ((response as any)?.results ?? []);
if (memories.length >= minCount) {
return memories; return memories;
} }
if (attempt < maxRetries) { if (attempt < maxRetries) {