Skip to content

test(import): cover landing stubs, api/docs rescue, and staging layout - #44

Merged
erunion merged 2 commits into
mainfrom
erunion/missing-test-coverage-325e
Aug 27, 2026
Merged

test(import): cover landing stubs, api/docs rescue, and staging layout#44
erunion merged 2 commits into
mainfrom
erunion/missing-test-coverage-325e

Conversation

@cursor

@cursor cursor Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor
🛖 Resolves

🧰 Changes

Adds regression tests for recent import fixes that shipped without coverage. Production behavior is unchanged aside from exposing existing helpers on import.js's __test__ hook.

Risky behavior now covered

  • Section landing-page injection — real common-prefix landings are imported; client-redirect stubs (meta refresh, canonical-to-child, HTTP redirect-to-child), import-base probes, single-child categories, 404s, and fetch failures are skipped.
  • /api/docs vs API reference — guides under /api/docs/* stay docs; /api/docs/api|reference|api-reference and /api/reference/* stay reference. skipApiReference staging rescues the docs subtree instead of dropping it.
  • Parent page staging — parents-with-children write index.md inside the folder (not a sibling <slug>.md); nested category folders that share a basename are namespaced and backed by a titled index.md; YAML-unsafe slugs are quoted in _order.yaml.
  • URL / title classification — API-reference and changelog path sweeps, auth-chrome URL pruning, discoverable-link filtering, and sidebar title cleanup (&amp;, zero-width chars).
  • llms.txt (section) markers — trailing (section) is stripped from H2/H3 titles so it never becomes a sidebar category name.

Test files added/updated

  • src/commands/import.landing.test.js (added)
  • src/commands/import.classify.test.js (added)
  • src/commands/import.staging.test.js (added)
  • src/utils/llms.test.js (updated)
  • src/commands/import.js (__test__ exports only)

Why these tests materially reduce regression risk

These paths decide what gets imported, how pages are classified (docs vs reference vs changelog vs auth chrome), and how the sidebar is written to disk. The recent fixes for empty parent pages (#32), /api/docs misclassification (#28), client-redirect stub landings (#29), and (section) titles (#25) had no tests; a future organize/staging change could silently drop guides, invent stub section pages, or write contentless sidebar parents.

🧬 QA & Testing

npm test

All 154 tests passed, including the new import/llms coverage. Tests are deterministic (mocked fetch, temp staging dirs) and do not depend on live sites.

Open in Web View Automation 

Add regression tests for recent import fixes that shipped without coverage:
section landing-page injection, /api/docs vs reference classification,
parent index.md staging, and llms.txt (section) title stripping.

Co-authored-by: Jon Ursenbach <erunion@users.noreply.github.com>
@erunion erunion added the enhancement New feature or request label Aug 27, 2026 — with Cursor
@erunion
erunion self-requested a review August 27, 2026 17:00
@erunion
erunion marked this pull request as ready for review August 27, 2026 17:02
@greptile-apps

greptile-apps Bot commented Aug 27, 2026

Copy link
Copy Markdown

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Reviews (2): Last reviewed commit: "Merge branch 'main' into erunion/missing..." | Re-trigger Greptile

@erunion
erunion merged commit 9cdfc42 into main Aug 27, 2026
4 checks passed
@erunion
erunion deleted the erunion/missing-test-coverage-325e branch August 27, 2026 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants