Skip to content

test: add test files for user contributions and profileinfo

srilatha bandari requested to merge test/user-contributions-profileinfo into test_cases

Description:

Added comprehensive unit test coverage for user-related components to improve reliability and maintainability.

  • Implemented 111 tests for UserProfileInfo covering:

    • Rendering, loading states, and permission handling
    • Display (read-only) and edit modes
    • Form updates, callbacks, and submission logic
    • API success/error handling and edge cases
    • Location timeline rendering and uncovered logic paths
  • Implemented 42 tests for UserContributions covering:

    • Rendering, loading, empty, and error states
    • Contribution display and metadata validation
    • Pagination and "Load More" functionality
    • Media type filtering (audio/video/image)
    • Navigation behavior
  • Added extensive mocking for:

    • API calls (fetch)
    • UI components (shadcn)
    • i18n translations
    • Location picker interactions
    • Toast notifications
    • localStorage
  • Ensured improved test coverage by targeting previously uncovered lines and edge cases.


Type of Change:

  • Bug Fix
  • Feature Development
  • Documentation

Testing:

  • Tested on desktop
  • Tested on mobile
  • Tested in different browsers

Commands used:

npm run test
npm run test:coverage

Screenshots:

Screenshot_from_2026-03-25_10-31-27


Checklist:

  • Code follows project style guidelines
  • Self-review completed
  • No console errors
  • TypeScript types are correct

closes #251 (closed)

Merge request reports

Loading