-
Notifications
You must be signed in to change notification settings - Fork 659
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ed20493
commit 1b8acd4
Showing
2 changed files
with
18 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
package com.stripe.android.paymentsheet.paymentdatacollection.ach | ||
|
||
import android.app.Application | ||
import androidx.lifecycle.SavedStateHandle | ||
import androidx.lifecycle.viewModelScope | ||
import androidx.test.core.app.ApplicationProvider | ||
|
@@ -21,7 +20,6 @@ import com.stripe.android.paymentsheet.model.PaymentIntentClientSecret | |
import com.stripe.android.paymentsheet.model.PaymentSelection | ||
import com.stripe.android.paymentsheet.paymentdatacollection.FormFragmentArguments | ||
import com.stripe.android.ui.core.Amount | ||
import com.stripe.android.ui.core.forms.resources.LpmRepository | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.ExperimentalCoroutinesApi | ||
import kotlinx.coroutines.flow.stateIn | ||
|
@@ -42,11 +40,6 @@ import kotlin.test.Test | |
@ExperimentalCoroutinesApi | ||
@RunWith(RobolectricTestRunner::class) | ||
class USBankAccountFormViewModelTest { | ||
private val lpmRepository = | ||
LpmRepository(LpmRepository.LpmRepositoryArguments(ApplicationProvider.getApplicationContext<Application>().resources)).apply { | ||
this.forceUpdate(listOf(PaymentMethod.Type.Card.code, PaymentMethod.Type.USBankAccount.code), null) | ||
} | ||
private val usBankAccount = lpmRepository.fromCode(PaymentMethod.Type.USBankAccount.code)!! | ||
|
||
private val defaultArgs = USBankAccountFormViewModel.Args( | ||
formArgs = FormFragmentArguments( | ||
|
@@ -128,7 +121,7 @@ class USBankAccountFormViewModelTest { | |
|
||
viewModel.handlePrimaryButtonClick(currentScreenState as USBankAccountFormScreenState.NameAndEmailCollection) | ||
|
||
verify(collectBankAccountLauncher).presentWithPaymentIntent(any(), any(), any()) | ||
verify(collectBankAccountLauncher).presentWithPaymentIntent(any(), any(), any(), any()) | ||
} | ||
|
||
@Test | ||
|
@@ -222,7 +215,7 @@ class USBankAccountFormViewModelTest { | |
|
||
viewModel.handlePrimaryButtonClick(currentScreenState as USBankAccountFormScreenState.NameAndEmailCollection) | ||
|
||
verify(collectBankAccountLauncher).presentWithPaymentIntent(any(), any(), any()) | ||
verify(collectBankAccountLauncher).presentWithPaymentIntent(any(), any(), any(), any()) | ||
} | ||
|
||
@Test | ||
|
@@ -299,7 +292,10 @@ class USBankAccountFormViewModelTest { | |
private fun createViewModel( | ||
args: USBankAccountFormViewModel.Args = defaultArgs | ||
): USBankAccountFormViewModel { | ||
val paymentConfiguration = PaymentConfiguration(ApiKeyFixtures.FAKE_PUBLISHABLE_KEY) | ||
val paymentConfiguration = PaymentConfiguration( | ||
ApiKeyFixtures.FAKE_PUBLISHABLE_KEY, | ||
STRIPE_ACCOUNT_ID | ||
) | ||
return USBankAccountFormViewModel( | ||
args = args, | ||
application = ApplicationProvider.getApplicationContext(), | ||
|
@@ -366,5 +362,6 @@ class USBankAccountFormViewModelTest { | |
const val MERCHANT_NAME = "merchantName" | ||
const val CUSTOMER_NAME = "Jenny Rose" | ||
const val CUSTOMER_EMAIL = "[email protected]" | ||
const val STRIPE_ACCOUNT_ID = "stripe_account_id" | ||
} | ||
} |