Skip to content

Commit

Permalink
remove enableDefaultPaymentMethods to getPaymentElementLoaderStateFor…
Browse files Browse the repository at this point in the history
…TestingOfPaymentMethodsWithDefaultPaymentMethodId
  • Loading branch information
tianzhao-stripe committed Jan 17, 2025
1 parent 9a94caa commit 2158905
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1955,8 +1955,6 @@ internal class DefaultPaymentElementLoaderTest {

@Test
fun `When DefaultPaymentMethod not null, no saved selection, paymentMethod order correct`() = runTest {
enableDefaultPaymentMethods.setEnabled(true)

val result = getPaymentElementLoaderStateForTestingOfPaymentMethodsWithDefaultPaymentMethodId()

val observedElements = result.customer?.paymentMethods
Expand All @@ -1966,8 +1964,6 @@ internal class DefaultPaymentElementLoaderTest {

@Test
fun `When DefaultPaymentMethod not null, and saved selection, paymentMethod order correct`() = runTest {
enableDefaultPaymentMethods.setEnabled(true)

val result = getPaymentElementLoaderStateForTestingOfPaymentMethodsWithDefaultPaymentMethodId(
setLastUsedIndex = 1
)
Expand All @@ -1979,8 +1975,6 @@ internal class DefaultPaymentElementLoaderTest {

@Test
fun `When DefaultPaymentMethod not null, and no savedSelection, selection correct`() = runTest {
enableDefaultPaymentMethods.setEnabled(true)

val result = getPaymentElementLoaderStateForTestingOfPaymentMethodsWithDefaultPaymentMethodId()

assertThat((result.paymentSelection as? PaymentSelection.Saved)?.paymentMethod).isEqualTo(
Expand All @@ -1990,8 +1984,6 @@ internal class DefaultPaymentElementLoaderTest {

@Test
fun `When DefaultPaymentMethod not null, and savedSelection, selection correct`() = runTest {
enableDefaultPaymentMethods.setEnabled(true)

val result = getPaymentElementLoaderStateForTestingOfPaymentMethodsWithDefaultPaymentMethodId(
setLastUsedIndex = 1
)
Expand Down Expand Up @@ -2542,6 +2534,8 @@ internal class DefaultPaymentElementLoaderTest {
private suspend fun getPaymentElementLoaderStateForTestingOfPaymentMethodsWithDefaultPaymentMethodId(
setLastUsedIndex: Int? = null
): PaymentElementLoader.State {
enableDefaultPaymentMethods.setEnabled(true)

val defaultPaymentMethodIndex = 2
val defaultPaymentMethod = paymentMethodsForTestingOrdering[defaultPaymentMethodIndex]
val defaultPaymentMethodId = defaultPaymentMethod.id
Expand Down

0 comments on commit 2158905

Please sign in to comment.