aboutsummaryrefslogtreecommitdiffstats
path: root/packages/trpc/lib/__tests__
diff options
context:
space:
mode:
authorAndrii Mokhovyk <andrii.mokhovyk@gmail.com>2026-01-18 16:36:49 +0200
committerGitHub <noreply@github.com>2026-01-18 14:36:49 +0000
commitc56cf4e24f6134547fb9c5b58eb20840f5083e9e (patch)
treeec9792cfcc6cbc6e45490d02e140b9241dca3fae /packages/trpc/lib/__tests__
parent1b98014d6cb0e3eb824d58ccbd35f39864e6ec88 (diff)
downloadkarakeep-c56cf4e24f6134547fb9c5b58eb20840f5083e9e.tar.zst
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
Diffstat (limited to 'packages/trpc/lib/__tests__')
-rw-r--r--packages/trpc/lib/__tests__/ruleEngine.test.ts33
1 files changed, 33 insertions, 0 deletions
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",