test: add test files for user contributions and profileinfo
Description:
Added comprehensive unit test coverage for user-related components to improve reliability and maintainability.
-
Implemented 111 tests for
UserProfileInfocovering:- 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
UserContributionscovering:- 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
- API calls (
-
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:
Checklist:
-
Code follows project style guidelines -
Self-review completed -
No console errors -
TypeScript types are correct
closes #251 (closed)
