Skip to content

Unit Tests for UsersService #70

@Josue19-08

Description

@Josue19-08

🔖 Title

Unit Tests for UsersService


📄 Description

Write comprehensive unit tests for the UsersService covering profile CRUD operations and validation logic. Mock all database interactions with Supabase. This issue can be completed independently once the users module is fully implemented.

Related to: Meta-issue #67


✅ Tasks to complete

  • Test getting user profile by wallet address
  • Test creating new user profile with valid data
  • Test updating user profile (name, avatar, preferences)
  • Test auto-creation of profile on first request
  • Test validation of user input data
  • Test handling of non-existent users
  • Test handling of duplicate wallet addresses
  • Mock Supabase client for all database operations
  • Test error scenarios (database failures, constraint violations)
  • Achieve 80%+ coverage for UsersService

📚 Documentation/context for AI

(This link never should removed)
https://github.com/TrustUp-app/TrustUp-API/tree/main/docs

Relevant documentation:

Dependencies:

  • Users module should be fully implemented (existing in codebase)

🗒️ Additional notes

Acceptance Criteria:

  • All test cases pass
  • Code coverage for UsersService is at least 80%
  • Database client is properly mocked
  • Tests validate both success and error paths
  • Input validation is thoroughly tested

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions