Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions worker/routes/pages.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,21 @@ test("public proof pages expose methodology and package ladder without overclaim
new RegExp(`<a class="cta" href="${origin}/check">Check one page now</a>`),
"methodology must carry a clickable CTA into the anonymous one-page check"
);
// Scout regression guard: every mention of the anonymous check URL on the
// methodology page must be clickable (a link href or a link's anchor text),
// never printed as plain text.
{
const checkUrl = `${origin}/check`;
const totalMentions = methodology.split(checkUrl).length - 1;
Comment on lines +53 to +54

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Count relative /check mentions in the guard

If an existing absolute-URL anchor is replaced with visible plain text such as /check, this guard still passes because it counts only ${origin}/check; both totalMentions and the clickable counts simply decrease together, while the other identical anchor satisfies the earlier assertion. The test therefore does not enforce its stated invariant for relative mentions of the same route, so it should inspect rendered text for both absolute and relative /check references.

Useful? React with 👍 / 👎.

const hrefMentions = methodology.split(`href="${checkUrl}"`).length - 1;
Comment on lines +54 to +55

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Accept clickable check URLs with suffixes

When a legitimate link adds a query string or fragment, such as href="https://seofixkit.com/check?source=methodology", totalMentions still counts the /check prefix but hrefMentions requires the closing quote immediately after it, so this guard fails even though the mention remains clickable. Count parsed anchors whose resolved URL targets the check route, or otherwise allow URL suffixes, to avoid blocking valid tracking parameters and fragments.

Useful? React with 👍 / 👎.

const linkTextMentions = methodology.split(`>${checkUrl}<`).length - 1;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Require URL text to be inside an anchor

The >${checkUrl}< count treats the URL as clickable inside any element, so changing one existing <a href="…">https://…/check</a> to <span>https://…/check</span> still satisfies this equality. The earlier exact-anchor assertion also continues to pass because the methodology page contains another identical anchor, leaving the new regression detector unable to catch precisely this plain-text regression; inspect actual anchor elements or check for URL text remaining after anchors are removed instead.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Ensure displayed check URLs point to the check route

If one displayed URL is changed to an anchor targeting another route, such as <a href=".../packages">https://seofixkit.com/check</a>, this guard still passes because linkTextMentions counts the text without verifying its enclosing anchor's destination; the earlier exact-anchor assertion also passes while the other identical anchor remains. This therefore misses a regression where users click a displayed /check URL but are sent to the wrong page, so each displayed URL should be validated together with its anchor's href.

Useful? React with 👍 / 👎.

assert.ok(totalMentions > 0, "methodology must mention the anonymous one-page check");
assert.equal(
totalMentions,
hrefMentions + linkTextMentions,
Comment on lines +54 to +60

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Count mentions inside actual anchor elements.

linkTextMentions matches any >${checkUrl}< sequence, including <p>${checkUrl}</p>. A non-clickable mention can therefore pass when another occurrence contributes a matching href count. Extract actual <a> elements with an HTML parser or a scoped matcher, then count only their href values and contents.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@worker/routes/pages.test.mjs` around lines 54 - 60, Update the
mention-counting assertions around totalMentions, hrefMentions, and
linkTextMentions to inspect only actual anchor elements. Use an HTML parser or
scoped anchor matcher to count matching href attributes and anchor contents,
excluding plain-text occurrences such as paragraph text, while preserving the
existing validation that the methodology mentions the check.

`every /check mention on the methodology page must be a clickable link (${totalMentions} mentions, ${hrefMentions} link hrefs, ${linkTextMentions} link texts)`
);
}
assert.match(methodology, /Why not just use a free AI SEO agent skill\?/);
assert.match(methodology, /Open-source SEO tooling is good at that/, "the free-skill answer must not disparage open source");
assert.match(methodology, /no live AI-engine sampling, no AI citation monitoring, and no ranking guarantees/i);
Expand Down
Loading