Skip to content

Commit

Permalink
FakeElementsSessionRepository
Browse files Browse the repository at this point in the history
  • Loading branch information
tianzhao-stripe committed Jan 17, 2025
1 parent e192eeb commit 2c11756
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class DefaultCustomerSessionElementsSessionManagerTest {

val lastParams = elementsSessionRepository.lastParams

assertThat(lastParams?.defaultPaymentMethodId).isEqualTo("pm_123")
assertThat(lastParams?.savedPaymentMethodSelectionId).isEqualTo("pm_123")
assertThat(lastParams?.externalPaymentMethods).isEmpty()

val initializationMode = lastParams?.initializationMode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1910,7 +1910,7 @@ internal class DefaultPaymentElementLoaderTest {
initializedViaCompose = false,
)

assertThat(repository.lastParams?.defaultPaymentMethodId)
assertThat(repository.lastParams?.savedPaymentMethodSelectionId)
.isEqualTo("pm_1234321")
}

Expand Down Expand Up @@ -1941,7 +1941,7 @@ internal class DefaultPaymentElementLoaderTest {
initializedViaCompose = false,
)

assertThat(repository.lastParams?.defaultPaymentMethodId).isNull()
assertThat(repository.lastParams?.savedPaymentMethodSelectionId).isNull()
}

@Test
Expand Down Expand Up @@ -1974,7 +1974,7 @@ internal class DefaultPaymentElementLoaderTest {
initializedViaCompose = false,
)

assertThat(repository.lastParams?.defaultPaymentMethodId).isNull()
assertThat(repository.lastParams?.savedPaymentMethodSelectionId).isNull()
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ internal class FakeElementsSessionRepository(
val initializationMode: PaymentElementLoader.InitializationMode,
val customer: PaymentSheet.CustomerConfiguration?,
val externalPaymentMethods: List<String>,
val defaultPaymentMethodId: String?
val savedPaymentMethodSelectionId: String?
)

var lastParams: Params? = null
Expand All @@ -35,7 +35,7 @@ internal class FakeElementsSessionRepository(
initializationMode = initializationMode,
customer = customer,
externalPaymentMethods = externalPaymentMethods,
defaultPaymentMethodId = savedPaymentMethodSelectionId,
savedPaymentMethodSelectionId = savedPaymentMethodSelectionId,
)
return if (error != null) {
Result.failure(error)
Expand Down

0 comments on commit 2c11756

Please sign in to comment.