aboutsummaryrefslogtreecommitdiffstats
path: root/packages/trpc/lib/__tests__/search.test.ts
diff options
context:
space:
mode:
authorMohamed Bassem <me@mbassem.com>2024-12-31 14:15:02 +0000
committerMohamed Bassem <me@mbassem.com>2024-12-31 14:20:48 +0000
commit96cc11ef321b4580430c05f9344c6eb7dbddcf23 (patch)
tree9d7115ff76a2c173794a9b8ce3a54463ab748145 /packages/trpc/lib/__tests__/search.test.ts
parent4deda9d477141e864f472ba95003e3974346f10d (diff)
downloadkarakeep-96cc11ef321b4580430c05f9344c6eb7dbddcf23.tar.zst
feat: Add support for searching for tagged and listed items
Diffstat (limited to 'packages/trpc/lib/__tests__/search.test.ts')
-rw-r--r--packages/trpc/lib/__tests__/search.test.ts24
1 files changed, 24 insertions, 0 deletions
diff --git a/packages/trpc/lib/__tests__/search.test.ts b/packages/trpc/lib/__tests__/search.test.ts
index 31f87dfd..bf32bcb1 100644
--- a/packages/trpc/lib/__tests__/search.test.ts
+++ b/packages/trpc/lib/__tests__/search.test.ts
@@ -344,6 +344,30 @@ describe("getBookmarkIdsFromMatcher", () => {
expect(result).toEqual(["b4"]);
});
+ it("should handle tagged matcher", async () => {
+ const matcher: Matcher = { type: "tagged", tagged: true };
+ const result = await getBookmarkIdsFromMatcher(mockCtx, matcher);
+ expect(result.sort()).toEqual(["b1", "b2", "b4", "b5", "b6"]);
+ });
+
+ it("should handle tagged matcher with tagged=false", async () => {
+ const matcher: Matcher = { type: "tagged", tagged: false };
+ const result = await getBookmarkIdsFromMatcher(mockCtx, matcher);
+ expect(result).toEqual(["b3"]);
+ });
+
+ it("should handle inlist matcher", async () => {
+ const matcher: Matcher = { type: "inlist", inList: true };
+ const result = await getBookmarkIdsFromMatcher(mockCtx, matcher);
+ expect(result.sort()).toEqual(["b1", "b2", "b4", "b5", "b6"]);
+ });
+
+ it("should handle inlist matcher with inList=false", async () => {
+ const matcher: Matcher = { type: "inlist", inList: false };
+ const result = await getBookmarkIdsFromMatcher(mockCtx, matcher);
+ expect(result).toEqual(["b3"]);
+ });
+
it("should throw error for unknown matcher type", async () => {
const matcher = { type: "unknown" } as unknown as Matcher;
await expect(getBookmarkIdsFromMatcher(mockCtx, matcher)).rejects.toThrow(