Skip to content

Commit c6c0c03

Browse files
test(auth): clear FirebaseAuthActivity launch caches between tests
1 parent ce8f56b commit c6c0c03

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

auth/src/main/java/com/firebase/ui/auth/FirebaseAuthActivity.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import android.app.Activity
1818
import android.content.Context
1919
import android.content.Intent
2020
import android.os.Bundle
21+
import androidx.annotation.RestrictTo
2122
import androidx.activity.ComponentActivity
2223
import androidx.activity.compose.setContent
2324
import androidx.activity.enableEdgeToEdge
@@ -219,6 +220,19 @@ class FirebaseAuthActivity : ComponentActivity() {
219220
}
220221
}
221222

223+
/**
224+
* Clears cached launch state. This method is intended for testing purposes only.
225+
*
226+
* @suppress This is an internal API and should not be used in production code.
227+
* @RestrictTo RestrictTo.Scope.TESTS
228+
*/
229+
@JvmStatic
230+
@RestrictTo(RestrictTo.Scope.TESTS)
231+
fun clearLaunchStateCache() {
232+
configurationCache.clear()
233+
authUICache.clear()
234+
}
235+
222236
private val authUICache = ConcurrentHashMap<String, FirebaseAuthUI>()
223237
}
224238
}

auth/src/test/java/com/firebase/ui/auth/FirebaseAuthActivityTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ class FirebaseAuthActivityTest {
111111

112112
@After
113113
fun tearDown() {
114+
FirebaseAuthActivity.clearLaunchStateCache()
114115
FirebaseAuthUI.clearInstanceCache()
115116
FirebaseApp.getApps(applicationContext).forEach { app ->
116117
try {

0 commit comments

Comments
 (0)