Skip to content

Commit

Permalink
clear linkAccountManager for each LinkTest
Browse files Browse the repository at this point in the history
  • Loading branch information
toluo-stripe committed Jan 30, 2025
1 parent 1f22c47 commit 1c37b33
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.google.testing.junit.testparameterinjector.TestParameter
import com.google.testing.junit.testparameterinjector.TestParameterInjector
import com.stripe.android.core.utils.urlEncode
import com.stripe.android.link.account.LinkStore
import com.stripe.android.link.injection.LinkAccountManagerModule
import com.stripe.android.networktesting.NetworkRule
import com.stripe.android.networktesting.RequestMatcher
import com.stripe.android.networktesting.RequestMatchers.bodyPart
Expand All @@ -21,6 +22,7 @@ import com.stripe.android.paymentsheet.utils.ProductIntegrationTypeProvider
import com.stripe.android.paymentsheet.utils.TestRules
import com.stripe.android.paymentsheet.utils.assertCompleted
import com.stripe.android.paymentsheet.utils.runProductIntegrationTest
import org.junit.After
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
Expand All @@ -43,6 +45,11 @@ internal class LinkTest {
@TestParameter(valuesProvider = ProductIntegrationTypeProvider::class)
lateinit var integrationType: ProductIntegrationType

@After
fun clearLinkAccountManagerModule() {
LinkAccountManagerModule.clear()
}

@Test
fun testSuccessfulCardPaymentWithLinkSignUp() = runProductIntegrationTest(
networkRule = networkRule,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.stripe.android.link.injection

import androidx.annotation.VisibleForTesting
import com.stripe.android.link.LinkConfiguration
import com.stripe.android.link.account.DefaultLinkAccountManager
import com.stripe.android.link.account.LinkAccountManager
Expand Down Expand Up @@ -33,4 +34,9 @@ internal object LinkAccountManagerModule {
}
}
}

@VisibleForTesting
fun clear() {
linkAccountManager = null
}
}

0 comments on commit 1c37b33

Please sign in to comment.