From c56cf4e24f6134547fb9c5b58eb20840f5083e9e Mon Sep 17 00:00:00 2001 From: Andrii Mokhovyk Date: Sun, 18 Jan 2026 16:36:49 +0200 Subject: feat(rules): add "Title Contains" condition to Rule Engine (#1670) (#2354) * feat(rules): add "Title Contains" condition to Rule Engine (#1670) * feat(rules): hide title conditions for bookmark created trigger * fix typecheck --- packages/trpc/lib/__tests__/ruleEngine.test.ts | 33 ++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'packages/trpc/lib/__tests__/ruleEngine.test.ts') diff --git a/packages/trpc/lib/__tests__/ruleEngine.test.ts b/packages/trpc/lib/__tests__/ruleEngine.test.ts index 600d8aa9..d7f216e5 100644 --- a/packages/trpc/lib/__tests__/ruleEngine.test.ts +++ b/packages/trpc/lib/__tests__/ruleEngine.test.ts @@ -126,6 +126,7 @@ describe("RuleEngine", () => { .values({ userId, type: BookmarkTypes.LINK, + title: "Example Bookmark Title", favourited: false, archived: false, }) @@ -235,6 +236,38 @@ describe("RuleEngine", () => { expect(engine.doesBookmarkMatchConditions(condition)).toBe(true); }); + it("should return true for titleContains condition", () => { + const condition: RuleEngineCondition = { + type: "titleContains", + str: "Example", + }; + expect(engine.doesBookmarkMatchConditions(condition)).toBe(true); + }); + + it("should return false for titleContains condition mismatch", () => { + const condition: RuleEngineCondition = { + type: "titleContains", + str: "nonexistent", + }; + expect(engine.doesBookmarkMatchConditions(condition)).toBe(false); + }); + + it("should return false for titleDoesNotContain condition when title contains string", () => { + const condition: RuleEngineCondition = { + type: "titleDoesNotContain", + str: "Example", + }; + expect(engine.doesBookmarkMatchConditions(condition)).toBe(false); + }); + + it("should return true for titleDoesNotContain condition when title does not contain string", () => { + const condition: RuleEngineCondition = { + type: "titleDoesNotContain", + str: "nonexistent", + }; + expect(engine.doesBookmarkMatchConditions(condition)).toBe(true); + }); + it("should return true for importedFromFeed condition", () => { const condition: RuleEngineCondition = { type: "importedFromFeed", -- cgit v1.2.3-70-g09d2