All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonTest.FlareTest.kt Maven / Gradle / Ivy

Go to download

Light the way for your app's backend with functional and testable Firebase components

There is a newer version: 1.0.0-alpha12
Show newest version
import enchant.flare.FirebaseApp
import enchant.flare.FirebaseOptions
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.TestResult
import kotlinx.coroutines.test.TestScope
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext
import kotlin.random.Random
import kotlin.test.BeforeTest

@OptIn(ExperimentalCoroutinesApi::class)
open class FlareTest {
    val useLocal = true //Whether local firebase classes should be used instead of production
    protected val testId: String = Random.nextInt().toString()

    init {
        if (!useLocal && FirebaseApp.getApps(context).isEmpty()) {
            FirebaseApp.initialize(
                context, null,
                options
                    ?: error("Need to specify [options] in FlareConfig.kt files for running production tests")
            )
        }
    }
}
/** Included Firebase options for running tests in production, specify in iosTest/kotlin/FlareConfig.kt
 * and androidAndroidTest/kotlin/FlareConfig.kt
 * ```
 * actual val options: FirebaseOptions? = null
 * or
 * actual val options: FirebaseOptions? FirebaseOptions(...)
 * ```
 *
 * */
expect val options: FirebaseOptions?




© 2015 - 2025 Weber Informatics LLC | Privacy Policy