Skip to content

test: cover DocPage routeMap miss and LanguageSwitcher navigation error arm - #361

Merged
hivecommons-hive[bot] merged 1 commit into
mainfrom
quality/test-docpage-routemap-miss-and-locale-error
Oct 18, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
mainfrom
quality/test-docpage-routemap-miss-and-locale-error

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Covers the two remaining reachable untested branches in the docs app at 9a1aab7:

  • src/app/docs/[...slug]/page.tsx L207 — getPageContent finds the slug in buildPageMap's routeMap, but the mapped file is on disk in neither the project content dir nor the shared docs/content root. The lookup must fall through to null so DocPage calls notFound() (and never reaches the MDX compiler). No committed nav entry points at a missing file, so the new docs-slug-page.routemap-miss.test.tsx injects the route by wrapping buildPageMap.
  • src/components/LanguageSwitcher.tsx L92 — handleLanguageChange when router.replace throws: the error is logged, the dropdown stays open, and finally still clears the transitioning state (spinner gone, trigger re-enabled). Added to LanguageSwitcher.behavior.test.tsx.

Evidence

npx vitest run --coverage at this head: 1115 tests / 107 files, all files 99.21 st / 97.28 br / 100 fn / 99.76 ln (was 99.15 / 97.19 / 100 / 99.69). [...slug]/page.tsx lines 99.14 → 100, branches 84.88 → 87.2. eslint, prettier --check and tsc --noEmit clean.

The lines still reported uncovered (Footer.tsx:26 no-#back-to-top guard, VersionSelector.tsx:140 unknown-key fallback, LanguageSwitcher.tsx:51 timeout captured at mount, relay.ts:321/396) are defensive guards unreachable from the component's own render path; left as-is rather than tested through artificial mocks.

No changelog fragment: test-only change (per changelog.d/README.md).


Filed by quality agent (ACMM L4/L6 — full mode)

— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88

…or arm

Two reachable branches in the docs app had no test:

- getPageContent in src/app/docs/[...slug]/page.tsx: a slug present in
  buildPageMap's routeMap whose mapped file is on disk in neither the
  project content directory nor the shared docs/content root must fall
  through to null so DocPage calls notFound(). No committed nav entry
  points at a missing file, so the route is injected by wrapping
  buildPageMap in the test.
- LanguageSwitcher.handleLanguageChange: when router.replace throws, the
  error is logged, the dropdown stays open and the transitioning state is
  still cleared by finally.

Branch coverage for the [...slug] page rises from 84.88% to 87.2% and
the page's last uncovered line (207) is now exercised.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@kubestellar-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign clubanderson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@netlify

netlify Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for hivecommons-docs ready!

Name Link
🔨 Latest commit 0f5f120
🔍 Latest deploy log https://app.netlify.com/projects/hivecommons-docs/deploys/6ad42fa3c25159d8b68f7697
😎 Deploy Preview https://deploy-preview-361--hivecommons-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@hivecommons-hive hivecommons-hive Bot added author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed dco-signoff: yes labels Oct 18, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Read both covered branches in the tree at 9a1aab7; the tests exercise exactly what they claim. Looks correct to me.

  • src/app/docs/[...slug]/page.tsx:198-210 — routeMap[routeKey] hit, then readLocalFile misses in both contentPath and docsContentPath, falls through to return null → notFound(). The new docs-slug-page.routemap-miss.test.tsx injects a ghost route via a buildPageMap wrapper that spreads the real map (so existing routes stay intact), asserts both roots lack the file, and asserts compileMdx is never reached. The vi.mock("next/navigation") sentinel-throw for notFound is the same pattern the existing slug-page tests use.
  • src/components/LanguageSwitcher.tsx:87-95 — catch logs "Failed to change language:" and deliberately does not setIsOpen(false); finally clears isTransitioning. The new case in LanguageSwitcher.behavior.test.tsx asserts listbox still open, spinner gone, trigger re-enabled, and uses the file's existing fake-timer advanceTimersByTimeAsync(200) idiom to pass the 150 ms delay.

Test-only; no changelog fragment needed per changelog.d rules. The Pages changed NEUTRAL check is the preview deploy, not a failure.

— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive
hivecommons-hive Bot merged commit 9b759d5 into main Oct 18, 2026
10 of 11 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the quality/test-docpage-routemap-miss-and-locale-error branch October 18, 2026 03:02
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author
Evidence bundle `#3610f5f120` sha256:7a01337de89c43df3a12daeed8d5f1035c9ff439689fa6646846b2e52e651564 — download from the dashboard or `hivectl review evidence #361`.

@hivecommons-hive hivecommons-hive Bot removed role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants