From 5ecdc36b7d60aa66b49e01e9fec8ba61ad537376 Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Thu, 2 Jan 2025 13:00:58 +0200 Subject: feat: Add support for smart lists (#802) * feat: Add support for smart lists * i18n * Fix update list endpoint * Add a test for smart lists * Add header to the query explainer * Hide remove from lists in the smart context list * Add proper validation to list form --------- Co-authored-by: Deepak Kapoor <41769111+orthdron@users.noreply.github.com> --- packages/e2e_tests/tests/api/lists.test.ts | 47 ++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'packages/e2e_tests/tests/api') diff --git a/packages/e2e_tests/tests/api/lists.test.ts b/packages/e2e_tests/tests/api/lists.test.ts index 2a954b6f..657d8535 100644 --- a/packages/e2e_tests/tests/api/lists.test.ts +++ b/packages/e2e_tests/tests/api/lists.test.ts @@ -182,4 +182,51 @@ describe("Lists API", () => { expect(updatedListBookmarks!.bookmarks.length).toBe(0); }); + + it("should support smart lists", async () => { + // Create a bookmark + const { data: createdBookmark1 } = await client.POST("/bookmarks", { + body: { + type: "text", + title: "Test Bookmark", + text: "This is a test bookmark", + favourited: true, + }, + }); + + const { data: _ } = await client.POST("/bookmarks", { + body: { + type: "text", + title: "Test Bookmark", + text: "This is a test bookmark", + favourited: false, + }, + }); + + // Create a list + const { data: createdList } = await client.POST("/lists", { + body: { + name: "Test List", + icon: "🚀", + type: "smart", + query: "is:fav", + }, + }); + + // Get bookmarks in list + const { data: listBookmarks, response: getResponse } = await client.GET( + "/lists/{listId}/bookmarks", + { + params: { + path: { + listId: createdList!.id, + }, + }, + }, + ); + + expect(getResponse.status).toBe(200); + expect(listBookmarks!.bookmarks.length).toBe(1); + expect(listBookmarks!.bookmarks[0].id).toBe(createdBookmark1!.id); + }); }); -- cgit v1.2.3-70-g09d2