Skip to content

test: add unit tests for DashboardHeader component#2475

Open
srinidhi-2006-bit wants to merge 1 commit into
Umbrella-io:mainfrom
srinidhi-2006-bit:test-dashboard-header-1042
Open

test: add unit tests for DashboardHeader component#2475
srinidhi-2006-bit wants to merge 1 commit into
Umbrella-io:mainfrom
srinidhi-2006-bit:test-dashboard-header-1042

Conversation

@srinidhi-2006-bit

Copy link
Copy Markdown
Contributor

Summary

Adds comprehensive unit tests for the DashboardHeader component using Vitest and React Testing Library. These tests improve coverage for rendering, session-based behavior, profile visibility, API interactions, and error handling.

Closes #1042


Type of Change

  • 🧪 Tests only

What Changed

  • Added additional unit tests in test/components/DashboardHeader.test.tsx
  • Added test coverage for authenticated and unauthenticated user states
  • Added tests for public/private profile visibility and settings fetch behavior
  • Added error handling test cases for failed API requests
  • Verified DashboardHeader rendering and key UI elements

How to Test

  1. Install dependencies:

    npm install
  2. Run the DashboardHeader test suite:

    npx vitest test/components/DashboardHeader.test.tsx
  3. Verify all tests pass successfully.

Expected result:

All DashboardHeader tests pass without failures and component behavior is validated across different session and API states.


Screenshots / Recordings

Not applicable (tests only).


Checklist

  • Linked the related issue above
  • Self-reviewed my own diff
  • No unnecessary console.log, debug code, or commented-out blocks
  • npm run lint passes locally
  • No TypeScript errors introduced by this change
  • Added or updated tests where applicable
  • Updated documentation / comments if behavior changed (not applicable)

Accessibility (UI changes only)

Not applicable (tests only).


Additional Context

The test suite now covers:

  • Dashboard heading and overview rendering
  • Authenticated vs unauthenticated states
  • User settings fetch behavior
  • Public profile visibility logic
  • Profile URL generation
  • Graceful handling of API failures

All tests pass locally using Vitest.

@github-actions github-actions Bot added type:testing GSSoC type bonus: tests (+10 pts) gssoc26 GSSoC 2026 contribution type:feature GSSoC type bonus: new feature labels Jun 15, 2026
@github-actions

Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Umbrella-io — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

@srinidhi-2006-bit

Copy link
Copy Markdown
Contributor Author

All component tests, linting, type checks, and coverage checks are passing successfully.

The remaining failure appears to be in the Playwright E2E workflow and may be unrelated to the DashboardHeader unit test changes introduced in this PR. Happy to investigate further if maintainers identify a specific issue connected to these changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc26 GSSoC 2026 contribution type:feature GSSoC type bonus: new feature type:testing GSSoC type bonus: tests (+10 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: add unit tests for DashboardHeader component

1 participant