Skip to content

test: add unit tests for DashboardHeader component#1333

Open
srinidhi-2006-bit wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
srinidhi-2006-bit:test/dashboardheader-unit-tests
Open

test: add unit tests for DashboardHeader component#1333
srinidhi-2006-bit wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
srinidhi-2006-bit:test/dashboardheader-unit-tests

Conversation

@srinidhi-2006-bit
Copy link
Copy Markdown
Contributor

Summary

Added unit tests for the DashboardHeader component using Jest and React Testing Library.

Closes #1042

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor / code cleanup

Changes Made

  • Added DashboardHeader.test.tsx
  • Mocked next-auth/react session handling
  • Mocked child UI components
  • Added rendering tests for dashboard heading and subtitle
  • Added tests for settings fetch behavior
  • Added tests for authenticated and unauthenticated states
  • Configured Jest setup for component testing

How to Test

Steps for the reviewer to verify this works:

  1. Run:

    npx jest src/components/__tests__/DashboardHeader.test.tsx
  2. Verify all tests pass successfully

  3. Run:

    npm run lint
    npm run type-check
  4. Verify there are no lint or TypeScript errors

Screenshots (if UI change)

N/A

Checklist

  • Linked issue in summary
  • npm run lint passes locally
  • No TypeScript errors (npm run type-check)
  • Self-reviewed the diff
  • Added/updated tests if applicable

@vercel
Copy link
Copy Markdown

vercel Bot commented May 27, 2026

@srinidhi-2006-bit is attempting to deploy a commit to the PRIYANSHU DOSHI's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:feature GSSoC type bonus: new feature type:testing GSSoC type bonus: tests (+10 pts) labels May 27, 2026
@github-actions
Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — 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

Hi @Priyanshu-byte-coder,

Implemented the requested unit tests for DashboardHeader and verified locally that:

  • npx jest src/components/__tests__/DashboardHeader.test.tsx passes
  • npm run lint passes
  • npm run type-check passes

The PR includes mocked session handling, fetch behavior tests, and conditional rendering coverage for the Share Profile functionality.

Could you please review the PR and add the gssoc:approved label if everything looks good?

Thank you!

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