I am using kotlin multiplatform for my project. SQLDelight is used to build the database. While writing a test for one of the classes using DataBaseCache
I encountered the error lateinit property appContext has not been initialized
. How can I initialize appContext
(perhaps with mockk
?) to a DataBaseCache
object?
actual object DataBaseCache {
lateinit var appContext: Context
actual fun cache(): MedtorDatabase {
val driver = AndroidSqliteDriver(MedtorDatabase.Schema, appContext, "medtor.db")
return MedtorDatabase(driver)
}
}