touchlab / KaMPKit

KaMP Kit by Touchlab. A collection of code & tools designed to get your mobile team started quickly w/Kotlin Multiplatform
https://touchlab.co/
Apache License 2.0
2.17k stars 196 forks source link

AndroidSqliteDriver is never used #291

Closed mecoFarid closed 1 year ago

mecoFarid commented 1 year ago

actual implementation of testDbConnection() for Android (TestUtilAndroid) checks if we are in instrumented test but in reality we never run instrumented test, and AndroidSqliteDriver is never used.

internal actual fun testDbConnection(): SqlDriver {
    // Try to use the android driver (which only works if we're on robolectric).
    // Fall back to jdbc if that fails.
    return try {
        val app = ApplicationProvider.getApplicationContext<Application>()
        AndroidSqliteDriver(KaMPKitDb.Schema, app, "kampkitdb")
    } catch (exception: IllegalStateException) {
        JdbcSqliteDriver(JdbcSqliteDriver.IN_MEMORY)
            .also { KaMPKitDb.Schema.create(it) }
    }
}
russhwolf commented 1 year ago

This is a relic of when we had Robolectric running some (but not all) of our tests. You're correct that it's no longer necessary. Feel free to open a PR, or we'll hit it sometime soon as we do other updates.