Skip to content

test(guides): validate internal links and guide anchors - #435

Merged
anurag629 merged 1 commit into
codercops:developfrom
srikar-naidu:test/guide-internal-links
Oct 30, 2026
Merged

anurag629 merged 1 commit into
codercops:developfrom
srikar-naidu:test/guide-internal-links

Conversation

@srikar-naidu

Copy link
Copy Markdown
Collaborator

What and why

Adds an automated guard against broken internal links in guide TSX pages.

The test checks literal JSX href values against existing page routes and validates guide anchors against literal id attributes. It resolves relative links, handles query strings, skips external URLs and non-page schemes, and reports the source guide, offending link, and failure reason.

Closes #432

How I tested this

  • npx vitest run lib/__tests__/guide-links.test.ts — all 16 tests passed.
  • Coverage includes existing links, missing routes, missing guide anchors, relative paths, query strings, external URLs, and link-like text in strings and comments.
  • git diff --check — passed.
  • Full lint, test, and build validation was started; final results are not yet confirmed.

AI assistance

AI helped implement the regression test and run validation commands.

Type of change

  • Bug fix
  • New tool or feature
  • Tests
  • Refactor or cleanup
  • Docs

Checklist

  • I was assigned the linked issue
  • npm run lint && npm run test && npm run build passes locally
  • Logic changes live in lib/ and have a test in lib/__tests__/
  • For a bug fix: the new test fails without my change
  • No analytics, trackers, or calls that send user data off-device
  • Works in both light and dark themes (if UI changed)
  • Inputs have labels and it works with the keyboard alone (if UI changed)
  • New tool: registry entry, page.tsx, client component, opengraph-image.tsx, and the bug report dropdown are all done

Notes for reviewers

Follows the maintainer’s narrowed scope: a filesystem-based test in lib/__tests__/ for TSX guide pages. It runs through the existing npm run test command and CI configuration.

Uses the existing TypeScript dependency to inspect JSX attributes. Dynamic expressions such as href={related.path} and generated IDs are outside this literal-attribute check.

No production code, dependencies, UI, package scripts, or CI configuration changed.

@anurag629 anurag629 added the hacktoberfest-accepted PR counts for Hacktoberfest label Oct 30, 2026
@anurag629
anurag629 merged commit 9b3c910 into codercops:develop Oct 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hacktoberfest-accepted PR counts for Hacktoberfest

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Guides: automatically check for broken internal links

2 participants