Skip to content

Commit 40eb5f2

Browse files
cboldisclaude
andcommitted
test(llmo): cover URL parse fallback branch in owned-urls handler
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 45a66e5 commit 40eb5f2

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

test/controllers/llmo/llmo-url-inspector.test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2351,6 +2351,20 @@ describe('URL Inspector Semrush BP integration', () => {
23512351
expect(callArgs.domain).to.equal('example.com');
23522352
expect(callArgs.urlFragment).to.equal('https://example.com/page');
23532353
});
2354+
2355+
it('falls back to raw url when URL parse fails in owned-urls', async () => {
2356+
const badUrlRow = { ...ownedRow(), url: 'not-a-valid-url' };
2357+
const { context, rpcStub } = createSemrushContext({ brandId: BRAND_ID });
2358+
rpcStub.resolves({ data: [badUrlRow], error: null });
2359+
2360+
const handler = Handlers.createUrlInspectorOwnedUrlsHandler(
2361+
async () => ({ organization: { getId: () => ORG_ID } }),
2362+
);
2363+
await handler(context);
2364+
2365+
const callArgs = queryBpCitationsByUrlStub.firstCall.args[5];
2366+
expect(callArgs.domain).to.equal('not-a-valid-url');
2367+
});
23542368
});
23552369

23562370
describe('createUrlInspectorUrlPromptsHandler — Semrush path', () => {

0 commit comments

Comments
 (0)