test: update batch delete test to use existing memory IDs

This commit is contained in:
kartik-mem0
2026-03-19 16:11:13 +05:30
parent 6bcfd3fad8
commit ba8b6616bb
@@ -12,7 +12,6 @@ import {
createTestClient, createTestClient,
suppressTelemetryNoise, suppressTelemetryNoise,
seedTestMemories, seedTestMemories,
waitForMemories,
cleanupTestUser, cleanupTestUser,
} from "./helpers"; } from "./helpers";
@@ -54,33 +53,12 @@ describeIntegration("MemoryClient Integration — Batch Operations", () => {
expect(typeof updated.memory).toBe("string"); expect(typeof updated.memory).toBe("string");
}); });
test("batch deletes throwaway memories", async () => { test("batch deletes memories that exist", async () => {
// Add a throwaway memory, wait for it, then batch-delete // Use one of the seeded memory IDs that we know exists
await client.add( expect(memoryIds.length).toBeGreaterThanOrEqual(1);
[
{
role: "user" as const,
content: "Temporary memory for batch delete test.",
},
{ role: "assistant" as const, content: "Noted!" },
],
{ user_id: TEST_USER_ID },
);
// Wait for new memory to appear const toDelete = [memoryIds[memoryIds.length - 1]];
const before = await waitForMemories( const result = await client.batchDelete(toDelete);
client,
TEST_USER_ID,
memoryIds.length + 1,
);
const throwawayIds = before
.filter((m) => !memoryIds.includes(m.id))
.map((m) => m.id);
// Assert we actually have something to delete
expect(throwawayIds.length).toBeGreaterThan(0);
const result = await client.batchDelete(throwawayIds);
expect(result).toBeDefined(); expect(result).toBeDefined();
}); });
}); });