|
|
|
@ -2,6 +2,7 @@ package org.tasks.injection
|
|
|
|
|
|
|
|
|
|
|
|
import android.content.Context
|
|
|
|
import android.content.Context
|
|
|
|
import androidx.room.Room
|
|
|
|
import androidx.room.Room
|
|
|
|
|
|
|
|
import androidx.sqlite.driver.bundled.BundledSQLiteDriver
|
|
|
|
import dagger.Module
|
|
|
|
import dagger.Module
|
|
|
|
import dagger.Provides
|
|
|
|
import dagger.Provides
|
|
|
|
import dagger.hilt.InstallIn
|
|
|
|
import dagger.hilt.InstallIn
|
|
|
|
@ -25,6 +26,7 @@ class TestModule {
|
|
|
|
@Singleton
|
|
|
|
@Singleton
|
|
|
|
fun getDatabase(@ApplicationContext context: Context): Database {
|
|
|
|
fun getDatabase(@ApplicationContext context: Context): Database {
|
|
|
|
return Room.inMemoryDatabaseBuilder(context, Database::class.java)
|
|
|
|
return Room.inMemoryDatabaseBuilder(context, Database::class.java)
|
|
|
|
|
|
|
|
.setDriver(BundledSQLiteDriver())
|
|
|
|
.fallbackToDestructiveMigration(dropAllTables = true)
|
|
|
|
.fallbackToDestructiveMigration(dropAllTables = true)
|
|
|
|
.build()
|
|
|
|
.build()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|