Skip to content

Commit

Permalink
Fixed unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kidinov committed Jan 27, 2025
1 parent 9f0e76f commit 18bbc62
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class CustomerListSelectionViewModel @Inject constructor(
override fun onCustomerSelected(customerModel: WCCustomerModel) {
analyticsTracker.track(
AnalyticsEvent.ORDER_CREATION_CUSTOMER_ADDED,
mapOf("is_customer_registered" to (customerModel.remoteCustomerId > 0L))
mapOf("is_customer_registered" to (customerModel.remoteCustomerId > 0L).toString())
)
when {
customerModel.remoteCustomerId > 0L -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,10 @@ class CustomerListSelectionViewModelTest : BaseUnitTest() {
)
)
)
verify(analyticsTrackerWrapper).track(AnalyticsEvent.ORDER_CREATION_CUSTOMER_ADDED)
verify(analyticsTrackerWrapper).track(
AnalyticsEvent.ORDER_CREATION_CUSTOMER_ADDED,
mapOf("is_customer_registered" to "true")
)
}

@Test
Expand Down Expand Up @@ -913,7 +916,10 @@ class CustomerListSelectionViewModelTest : BaseUnitTest() {
// THEN
assertThat(states[0].partialLoading).isFalse
assertThat(states[1].partialLoading).isTrue
verify(analyticsTrackerWrapper).track(AnalyticsEvent.ORDER_CREATION_CUSTOMER_ADDED)
verify(analyticsTrackerWrapper).track(
AnalyticsEvent.ORDER_CREATION_CUSTOMER_ADDED,
mapOf("is_customer_registered" to "true")
)
}

@Test
Expand Down Expand Up @@ -966,7 +972,10 @@ class CustomerListSelectionViewModelTest : BaseUnitTest() {
)
)
)
verify(analyticsTrackerWrapper).track(AnalyticsEvent.ORDER_CREATION_CUSTOMER_ADDED)
verify(analyticsTrackerWrapper).track(
AnalyticsEvent.ORDER_CREATION_CUSTOMER_ADDED,
mapOf("is_customer_registered" to "true")
)
}

@Test
Expand Down Expand Up @@ -1026,7 +1035,10 @@ class CustomerListSelectionViewModelTest : BaseUnitTest() {
)
)
)
verify(analyticsTrackerWrapper).track(AnalyticsEvent.ORDER_CREATION_CUSTOMER_ADDED)
verify(analyticsTrackerWrapper).track(
AnalyticsEvent.ORDER_CREATION_CUSTOMER_ADDED,
mapOf("is_customer_registered" to "true")
)
}

@Test
Expand Down Expand Up @@ -1076,7 +1088,10 @@ class CustomerListSelectionViewModelTest : BaseUnitTest() {
)
)
)
verify(analyticsTrackerWrapper).track(AnalyticsEvent.ORDER_CREATION_CUSTOMER_ADDED)
verify(analyticsTrackerWrapper).track(
AnalyticsEvent.ORDER_CREATION_CUSTOMER_ADDED,
mapOf("is_customer_registered" to "false")
)
}

@Test
Expand Down

0 comments on commit 18bbc62

Please sign in to comment.