Skip to content

test: add behavior tests for RelatedProjects sidebar component - #140

Merged
hivecommons-hive[bot] merged 1 commit into
mainfrom
quality/test-related-projects
Sep 30, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
mainfrom
quality/test-related-projects

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds src/__tests__/RelatedProjects.behavior.test.tsx (13 tests) for src/components/docs/RelatedProjects.tsx, previously the largest fully-uncovered file in src/ (399 lines, 0%). Follows the existing behavior-test pattern (jsdom pragma; vi.mock of next/navigation, next-themes, next/link, @/hooks/useSharedConfig).

Covered behavior:

  • getCurrentProject() pathname→highlight mapping, general-section highlighting, and the Hive fallback
  • getProjectUrl() branch-deploy handling: relative on production-like hosts, absolute https://docs.hivecommons.dev prefix (rendered as plain <a>) elsewhere
  • static placeholder fallback when shared config is unavailable
  • Legacy section: collapsed by default, button toggle, autoExpandLegacy prop sync across rerenders
  • renderLegacyMenuTree(): depth<2 always visible, depth≥2 expand/collapse buttons, Link vs <a> selection, # route fallback, tree hidden for non-current projects
  • slim variant: theme toggle calls setTheme with the opposite theme; expand button calls onCollapse

Results: file 0% → 89.7% lines; suite 726 → 739 tests, all green; overall lines 73.9% → 78.1%. eslint and tsc --noEmit clean. Includes a changelog.d/added- fragment.

Closes #139


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

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

Covers pathname-based project highlighting, branch-deploy URL prefixing,
the static config fallback, the Legacy section collapse/expand and
autoExpandLegacy sync, recursive legacy menu-tree rendering, and the slim
variant's theme toggle and onCollapse button. Lifts the file from 0% to
~90% line coverage.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: quality <quality@hive.kubestellar.io>
@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 Sep 30, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for hivecommons-docs ready!

Name Link
🔨 Latest commit c5aa9af
🔍 Latest deploy log https://app.netlify.com/projects/hivecommons-docs/deploys/6abcfd9a3ac35900093b74cb
😎 Deploy Preview https://deploy-preview-140--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 merged commit 29b21c9 into main Sep 30, 2026
9 of 10 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the quality/test-related-projects branch September 30, 2026 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] RelatedProjects.tsx (399 lines): largest 0%-covered file — sidebar routing/highlighting logic untested

0 participants