diff --git a/src/helpers/__tests__/find-rule.test.ts b/src/helpers/__tests__/find-rule.test.ts index 69ce1d7..4bdb1ff 100644 --- a/src/helpers/__tests__/find-rule.test.ts +++ b/src/helpers/__tests__/find-rule.test.ts @@ -13,4 +13,7 @@ test("findRule()", () => { path: "youtube.com", type: "block", }); + + expect(findRule("https://www.nginx.com/", ["x.com"])).toBe(undefined); + expect(findRule("https://x.com/", ["nginx.com"])).toBe(undefined); }); diff --git a/src/helpers/find-rule.ts b/src/helpers/find-rule.ts index 25f1794..c93498e 100644 --- a/src/helpers/find-rule.ts +++ b/src/helpers/find-rule.ts @@ -4,6 +4,6 @@ import makeRules, { Rule } from "./make-rules"; export default (url: string, blocked: string[]): Rule | undefined => { const normalizedUrl = normalizeUrl(url); const rules = makeRules(blocked); - const foundRule = rules.find((rule) => normalizedUrl.startsWith(rule.path) || normalizedUrl.endsWith(rule.path)); + const foundRule = rules.find((rule) => normalizedUrl.startsWith(rule.path)); return foundRule; };