|
8 | 8 |
|
9 | 9 | package com.adyen.checkout.googlepay.internal.ui
|
10 | 10 |
|
| 11 | +import android.app.Activity |
11 | 12 | import app.cash.turbine.test
|
12 | 13 | import com.adyen.checkout.components.core.Amount
|
13 | 14 | import com.adyen.checkout.components.core.CheckoutConfiguration
|
14 | 15 | import com.adyen.checkout.components.core.Configuration
|
15 | 16 | import com.adyen.checkout.components.core.OrderRequest
|
16 | 17 | import com.adyen.checkout.components.core.PaymentMethod
|
17 | 18 | import com.adyen.checkout.components.core.internal.PaymentObserverRepository
|
| 19 | +import com.adyen.checkout.components.core.internal.analytics.ErrorEvent |
18 | 20 | import com.adyen.checkout.components.core.internal.analytics.GenericEvents
|
19 | 21 | import com.adyen.checkout.components.core.internal.analytics.TestAnalyticsManager
|
20 | 22 | import com.adyen.checkout.components.core.internal.ui.model.CommonComponentParamsMapper
|
@@ -185,6 +187,28 @@ internal class DefaultGooglePayDelegateTest {
|
185 | 187 |
|
186 | 188 | analyticsManager.assertIsCleared()
|
187 | 189 | }
|
| 190 | + |
| 191 | + @Test |
| 192 | + fun `when activity result is OK and data is null, then error event is tracked`() { |
| 193 | + delegate.handleActivityResult(Activity.RESULT_OK, data = null) |
| 194 | + |
| 195 | + val expectedEvent = GenericEvents.error( |
| 196 | + component = TEST_PAYMENT_METHOD_TYPE, |
| 197 | + event = ErrorEvent.THIRD_PARTY, |
| 198 | + ) |
| 199 | + analyticsManager.assertLastEventEquals(expectedEvent) |
| 200 | + } |
| 201 | + |
| 202 | + @Test |
| 203 | + fun `when activity result is CANCELLED, then error event is tracked`() { |
| 204 | + delegate.handleActivityResult(Activity.RESULT_CANCELED, data = null) |
| 205 | + |
| 206 | + val expectedEvent = GenericEvents.error( |
| 207 | + component = TEST_PAYMENT_METHOD_TYPE, |
| 208 | + event = ErrorEvent.THIRD_PARTY, |
| 209 | + ) |
| 210 | + analyticsManager.assertLastEventEquals(expectedEvent) |
| 211 | + } |
188 | 212 | }
|
189 | 213 |
|
190 | 214 | private fun createCheckoutConfiguration(
|
|
0 commit comments