Skip to content

Add unit tests for API layer and Volunteer Register page to improve coverage

Vandana reddy Balannagari requested to merge testcase into develop

What does this MR do and why?

This Merge Request adds unit test cases to improve overall project test coverage.

Changes included:

  • Added comprehensive unit tests for lib/api.ts

    • Covered success and error scenarios
    • Tested request and response interceptors
    • Covered conditional logic (if/else, try/catch)
    • Covered functions that throw errors
    • Covered functions that return null on failure
    • Covered optional parameters and query string logic
    • Covered Promise.all and Map merge logic in analytics
  • Added unit tests for VolunteerRegisterPage

    • Component render validation
    • Form interaction testing
    • Input change handling
    • Submission handling
    • Validation and error scenarios

Why this change?

  • To increase overall test coverage (target: 75%+)
  • To ensure API layer reliability
  • To validate critical volunteer registration flow
  • To improve branch and function coverage
  • To strengthen error handling validation

No existing functionality, logic, or output was modified. Only test files were added.


References

  • Vitest documentation
  • Axios mocking patterns
  • Project coverage requirements

Screenshots

Before Screenshot_from_2026-02-27_17-55-13 After Screenshot_from_2026-02-27_17-47-06


Edited by Vandana reddy Balannagari

Merge request reports

Loading