File tree Expand file tree Collapse file tree
main/java/com/stripe/android/checkout
test/java/com/stripe/android/checkout Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -150,6 +150,7 @@ class Checkout private constructor(
150150 set(value) {
151151 ensureNoMutationInFlight()
152152 internalState = value.internalState
153+ _checkoutSession .value = internalState.checkoutSessionResponse.asCheckoutSession()
153154 }
154155
155156 private val mutex = Mutex ()
Original file line number Diff line number Diff line change @@ -776,6 +776,18 @@ class CheckoutTest {
776776 deferred.await()
777777 }
778778
779+ @Test
780+ fun `setting state updates checkoutSession flow` () = runCreateWithStateScenario {
781+ val initial = checkoutSessionTurbine.awaitItem()
782+ assertThat(initial.id).isEqualTo(DEFAULT_CHECKOUT_SESSION_ID )
783+
784+ val updatedResponse = CheckoutSessionResponseFactory .create(id = " cs_test_updated" )
785+ checkout.state = CheckoutStateFactory .create(checkoutSessionResponse = updatedResponse)
786+
787+ val updated = checkoutSessionTurbine.awaitItem()
788+ assertThat(updated.id).isEqualTo(" cs_test_updated" )
789+ }
790+
779791 @Test
780792 fun `mutation returns failure when integrationLaunched is true` () = runCreateWithStateScenario(
781793 shouldValidateEvents = false ,
You can’t perform that action at this time.
0 commit comments