Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test: Add ServiceAlertsViewModel tests and make toServiceAlert public #530

Merged
merged 1 commit into from
Jan 11, 2025

Conversation

ksharma-xyz
Copy link
Owner

@ksharma-xyz ksharma-xyz commented Jan 10, 2025

TL;DR

Added unit tests for ServiceAlertsViewModel and made toServiceAlert function public.

What changed?

  • Created new ServiceAlertsViewModelTest class with test coverage for initial state and alert fetching
  • Made toServiceAlert() function public to support testing
  • Removed commented code in TimeTableViewModelTest
  • Added test cases to verify analytics tracking and proper state management

How to test?

  1. Run the unit tests in ServiceAlertsViewModelTest
  2. Verify that both test cases pass:
    • Initial state test
    • Alert fetching test with mock data
  3. Confirm analytics events are properly tracked

Why make this change?

To ensure the ServiceAlertsViewModel behaves correctly and maintains proper state management. This change improves test coverage and helps catch potential regressions in the service alerts functionality.

@ksharma-xyz ksharma-xyz changed the title Add ut for ServiceAlertVM Test: Add ServiceAlertsViewModel tests and make toServiceAlert public Jan 10, 2025
@ksharma-xyz ksharma-xyz marked this pull request as ready for review January 10, 2025 10:35
@ksharma-xyz ksharma-xyz added this to the 1.0.5 milestone Jan 10, 2025
@ksharma-xyz ksharma-xyz force-pushed the 01-10-add_ut_for_selectedtransportmode_for_theme branch from ec21e47 to 298513e Compare January 11, 2025 00:46
@ksharma-xyz ksharma-xyz force-pushed the 01-10-add_ut_for_servicealertvm branch from b088b6b to ab69f5b Compare January 11, 2025 00:46
Base automatically changed from 01-10-add_ut_for_selectedtransportmode_for_theme to main January 11, 2025 01:00
@ksharma-xyz ksharma-xyz force-pushed the 01-10-add_ut_for_servicealertvm branch from ab69f5b to 6ca256b Compare January 11, 2025 05:06
@ksharma-xyz ksharma-xyz enabled auto-merge (squash) January 11, 2025 05:06
@ksharma-xyz ksharma-xyz merged commit 63cae55 into main Jan 11, 2025
2 checks passed
@ksharma-xyz ksharma-xyz deleted the 01-10-add_ut_for_servicealertvm branch January 11, 2025 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant