Skip to content

Unit Tests for All ViewModels #48

@Josemiles-ctr

Description

@Josemiles-ctr

Description

Write comprehensive unit tests for all ViewModels to ensure business logic correctness.

Detailed Requirements

  • Test ViewModels:

    • AuthViewModel (login, signup, logout)
    • UserViewModel (profile management)
    • HospitalViewModel (hospital list, details)
    • RequestViewModel (submit, track requests)
    • AdminViewModel (manage requests, ambulances)
    • DriverViewModel (status management)
  • Test coverage:

    • Happy path scenarios
    • Error scenarios
    • State management
    • Navigation logic
    • Data validation
  • Target coverage: ≥85%

Technical Details

  • Framework: JUnit 4 with Mockito
  • Coroutines: Using runTest for async tests
  • Mock: Mock Repository and API calls
  • Test structure: Given-When-Then pattern

Acceptance Criteria

  • All ViewModels have unit tests
  • Happy path scenarios tested
  • Error scenarios tested
  • State transitions tested
  • Data validation tested
  • Coverage report generated
  • Coverage ≥85% for all ViewModels
  • All tests pass
  • Tests run in CI/CD pipeline

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions