diff --git a/src/client/features/backlinks/backlinksSearchScope.test.ts b/src/client/features/backlinks/backlinksSearchScope.test.ts index 2f0fb22..3a024c1 100644 --- a/src/client/features/backlinks/backlinksSearchScope.test.ts +++ b/src/client/features/backlinks/backlinksSearchScope.test.ts @@ -16,12 +16,18 @@ describe("inferBacklinksSearchScopeFromTarget", () => { ); }); - it("treats explicit urls as page lookups", () => { + it("treats root urls with explicit protocol as domain lookups", () => { expect(inferBacklinksSearchScopeFromTarget("https://example.com/")).toBe( - "page", + "domain", ); }); + it("treats explicit urls with a path as page lookups", () => { + expect( + inferBacklinksSearchScopeFromTarget("https://example.com/pricing"), + ).toBe("page"); + }); + it("uses inferred scope until the user overrides it", () => { expect( resolveBacklinksSearchScope({ diff --git a/src/client/features/backlinks/backlinksSearchScope.ts b/src/client/features/backlinks/backlinksSearchScope.ts index 4219574..dad8e5b 100644 --- a/src/client/features/backlinks/backlinksSearchScope.ts +++ b/src/client/features/backlinks/backlinksSearchScope.ts @@ -14,7 +14,7 @@ export function inferBacklinksSearchScopeFromTarget( const parsed = new URL( hasExplicitProtocol ? trimmed : `https://${trimmed}`, ); - return hasExplicitProtocol || parsed.pathname !== "/" ? "page" : "domain"; + return parsed.pathname !== "/" ? "page" : "domain"; } catch { return "domain"; }