Skip to content

Commit

Permalink
Add a test for smart lists
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedBassem committed Jan 2, 2025
1 parent 4d32f0f commit 6ac3b76
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions packages/e2e_tests/tests/api/lists.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});

0 comments on commit 6ac3b76

Please sign in to comment.