fix(sdk): removing deprecating param from our sdk and docs changes with it (#4740)
This commit is contained in:
@@ -122,7 +122,9 @@ describeIntegration("MemoryClient Integration — CRUD", () => {
|
||||
// ─── Get all ──────────────────────────────────────────────
|
||||
describe("get all memories", () => {
|
||||
test("returns all memories for test user", async () => {
|
||||
const memories = await client.getAll({ user_id: TEST_USER_ID });
|
||||
const memories = await client.getAll({
|
||||
filters: { user_id: TEST_USER_ID },
|
||||
});
|
||||
|
||||
expect(Array.isArray(memories)).toBe(true);
|
||||
expect(memories.length).toBeGreaterThanOrEqual(memoryIds.length);
|
||||
@@ -135,7 +137,7 @@ describeIntegration("MemoryClient Integration — CRUD", () => {
|
||||
|
||||
test("returns paginated results with page and page_size", async () => {
|
||||
const page1 = await client.getAll({
|
||||
user_id: TEST_USER_ID,
|
||||
filters: { user_id: TEST_USER_ID },
|
||||
page: 1,
|
||||
page_size: 1,
|
||||
});
|
||||
@@ -200,7 +202,7 @@ describeIntegration("MemoryClient Integration — CRUD", () => {
|
||||
|
||||
test("getAll for non-existent user returns empty array", async () => {
|
||||
const memories = await client.getAll({
|
||||
user_id: `nonexistent-user-${randomUUID()}`,
|
||||
filters: { user_id: `nonexistent-user-${randomUUID()}` },
|
||||
});
|
||||
|
||||
expect(Array.isArray(memories)).toBe(true);
|
||||
|
||||
@@ -63,7 +63,9 @@ export async function waitForMemories(
|
||||
maxRetries = 4,
|
||||
): Promise<Memory[]> {
|
||||
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
||||
const memories = await withRetry(() => client.getAll({ user_id: userId }));
|
||||
const memories = await withRetry(() =>
|
||||
client.getAll({ filters: { user_id: userId } }),
|
||||
);
|
||||
if (Array.isArray(memories) && memories.length >= minCount) {
|
||||
return memories;
|
||||
}
|
||||
|
||||
@@ -31,10 +31,10 @@ describeIntegration("MemoryClient Integration — Initialization", () => {
|
||||
|
||||
afterAll(() => cleanup());
|
||||
|
||||
test("client pings successfully and resolves org/project", async () => {
|
||||
test("client pings successfully", async () => {
|
||||
await client.ping();
|
||||
expect(client.organizationId).toBeTruthy();
|
||||
expect(client.projectId).toBeTruthy();
|
||||
// org/project are now resolved internally from the API key
|
||||
expect(client.telemetryId).toBeTruthy();
|
||||
});
|
||||
|
||||
test("get with invalid ID throws ValidationError", async () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Integration tests: Search and history operations.
|
||||
*
|
||||
* Tests search v1, search v2, and memory history against the real API.
|
||||
* Tests search, filtered search, and memory history against the real API.
|
||||
*
|
||||
* Run: MEM0_API_KEY=your-key npx jest search.test.ts --forceExit
|
||||
*/
|
||||
@@ -36,14 +36,14 @@ describeIntegration("MemoryClient Integration — Search & History", () => {
|
||||
cleanup();
|
||||
});
|
||||
|
||||
// ─── Search v1 ────────────────────────────────────────────
|
||||
describe("search v1", () => {
|
||||
// ─── Search ─────────────────────────────────────────────
|
||||
describe("search", () => {
|
||||
test("searches memories by user_id and returns results with scores", async () => {
|
||||
// Search index may lag behind listing index — poll until ready
|
||||
const results = await waitForSearchResults(
|
||||
client,
|
||||
"What is my favorite color?",
|
||||
{ user_id: TEST_USER_ID },
|
||||
{ filters: { user_id: TEST_USER_ID } },
|
||||
);
|
||||
|
||||
expect(Array.isArray(results)).toBe(true);
|
||||
@@ -57,15 +57,14 @@ describeIntegration("MemoryClient Integration — Search & History", () => {
|
||||
});
|
||||
});
|
||||
|
||||
// ─── Search v2 ────────────────────────────────────────────
|
||||
describe("search v2", () => {
|
||||
// ─── Search with filters ─────────────────────────────────
|
||||
describe("search with filters", () => {
|
||||
test("searches with OR filters and returns results", async () => {
|
||||
const results = await waitForSearchResults(
|
||||
client,
|
||||
"What do you know about me?",
|
||||
{
|
||||
filters: { OR: [{ user_id: TEST_USER_ID }] },
|
||||
api_version: "v2",
|
||||
},
|
||||
);
|
||||
|
||||
@@ -110,19 +109,19 @@ describeIntegration("MemoryClient Integration — Search & History", () => {
|
||||
describe("edge cases", () => {
|
||||
test("search for non-existent user returns empty results", async () => {
|
||||
const results = await client.search("anything", {
|
||||
user_id: `nonexistent-user-${randomUUID()}`,
|
||||
filters: { user_id: `nonexistent-user-${randomUUID()}` },
|
||||
});
|
||||
|
||||
expect(Array.isArray(results)).toBe(true);
|
||||
expect(results.length).toBe(0);
|
||||
});
|
||||
|
||||
test("search with limit param does not throw", async () => {
|
||||
test("search with top_k param does not throw", async () => {
|
||||
const results = await client.search(
|
||||
"Tell me about integration test user",
|
||||
{
|
||||
user_id: TEST_USER_ID,
|
||||
limit: 1,
|
||||
filters: { user_id: TEST_USER_ID },
|
||||
top_k: 1,
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user