Skip to content

test(sidebar): add coverage for collapse persistence and nav states#731

Merged
utksh1 merged 4 commits into
utksh1:mainfrom
jyotsnak1603:test-556-sidebar-coverage
Jun 9, 2026
Merged

test(sidebar): add coverage for collapse persistence and nav states#731
utksh1 merged 4 commits into
utksh1:mainfrom
jyotsnak1603:test-556-sidebar-coverage

Conversation

@jyotsnak1603

Copy link
Copy Markdown
Contributor

Description

This PR adds direct unit test coverage for the Sidebar component.

Changes included:

  • Added tests for persisted collapse/expand state behavior using local storage
  • Verified that collapse state is restored correctly across renders
  • Added coverage for sidebar toggle interactions
  • Added tests for active navigation state rendering across supported routes
  • Added tests for highlighted navigation state rendering
  • Verified expected navigation links and section headers are rendered correctly

The tests focus on user-visible behavior and state persistence rather than animation or motion implementation details.

Related Issues

Fixes #556

Type of Change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Executed:

npm --prefix frontend test -- Sidebar.test.tsx
npm run typecheck
npm run quality

Results:

  • 19/19 Sidebar tests passed
  • TypeScript type checking passed
  • Frontend quality gate passed

Verified that:

  • Collapse state persists correctly across renders
  • Toggle interactions update persisted state
  • Active navigation items are rendered correctly
  • Highlighted navigation states are rendered correctly
  • Navigation structure remains intact

Checklist

  • My code follows the code style of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.

Copilot AI review requested due to automatic review settings June 9, 2026 16:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a new unit test suite for the Sidebar component to validate persisted collapse state, active/highlight nav styling, and expected navigation structure.

Changes:

  • Added Sidebar unit tests for localStorage-backed collapse persistence and toggle interactions.
  • Added tests asserting active route styling/indicators and highlight styling behavior.
  • Introduced test-only mocks for framer-motion and ThemeToggle to isolate sidebar behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread frontend/testing/unit/components/Sidebar.test.tsx Outdated
Comment thread frontend/testing/unit/components/Sidebar.test.tsx Outdated
Comment thread frontend/testing/unit/components/Sidebar.test.tsx Outdated
Comment thread frontend/testing/unit/components/Sidebar.test.tsx Outdated
@jyotsnak1603

Copy link
Copy Markdown
Contributor Author

Hi @utksh1,

Implemented the requested Sidebar test coverage for collapse persistence and navigation states.

All CI checks are now passing successfully.

Test coverage includes:

  • Collapse/expand state persistence
  • Sidebar toggle behavior
  • Active navigation state rendering
  • Highlighted navigation state rendering

Requesting review when convenient. Thank you!

@utksh1 utksh1 added level:intermediate 35 pts difficulty label for moderate contributor PRs type:testing Testing work category bonus label area:frontend Frontend React/UI work gssoc:approved Admin validation: approved for GSSoC scoring labels Jun 9, 2026

@utksh1 utksh1 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Scoped frontend test coverage for Sidebar collapse persistence and navigation states. CI is green on the reviewed head; approved pending branch update and fresh checks.

@utksh1 utksh1 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Re-approving current head after the normal branch update. The PR remains scoped to Sidebar unit coverage and all fresh checks are green.

@utksh1 utksh1 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Approved current head after addressing the unresolved review threads. The Sidebar test suite now uses ESM-safe mocks, user-event interactions, and behavior-oriented active-route assertions. Fresh CI is green.

@utksh1 utksh1 merged commit b7a6cc7 into utksh1:main Jun 9, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:frontend Frontend React/UI work gssoc:approved Admin validation: approved for GSSoC scoring level:intermediate 35 pts difficulty label for moderate contributor PRs type:testing Testing work category bonus label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TEST] Add Sidebar coverage for collapse persistence and highlighted nav states

3 participants