diff --git a/appcompose/src/androidTest/java/com/readrops/app/compose/LocalRSSRepositoryTest.kt b/appcompose/src/androidTest/java/com/readrops/app/compose/LocalRSSRepositoryTest.kt index 6eaea4ab..b479d3ab 100644 --- a/appcompose/src/androidTest/java/com/readrops/app/compose/LocalRSSRepositoryTest.kt +++ b/appcompose/src/androidTest/java/com/readrops/app/compose/LocalRSSRepositoryTest.kt @@ -12,6 +12,7 @@ import com.readrops.db.entities.Feed import com.readrops.db.entities.account.Account import com.readrops.db.entities.account.AccountType import kotlinx.coroutines.runBlocking +import kotlinx.coroutines.test.runTest import okhttp3.OkHttpClient import okhttp3.mockwebserver.MockResponse import okhttp3.mockwebserver.MockWebServer @@ -37,7 +38,7 @@ class LocalRSSRepositoryTest : KoinTest { private lateinit var feeds: List @Before - fun before() { + fun before() = runTest { val context = ApplicationProvider.getApplicationContext() database = Room.inMemoryDatabaseBuilder(context, Database::class.java).build() @@ -57,7 +58,7 @@ class LocalRSSRepositoryTest : KoinTest { mockServer.start() val url = mockServer.url("/rss") - account.id = database.accountDao().compatInsert(account).toInt() + account.id = database.newAccountDao().insert(account).toInt() feeds = listOf( Feed( name = "feedTest", @@ -66,17 +67,15 @@ class LocalRSSRepositoryTest : KoinTest { ), ) - runBlocking { - database.newFeedDao().insert(feeds).run { - feeds.first().id = first().toInt() - } + database.newFeedDao().insert(feeds).apply { + feeds.first().id = first().toInt() } repository = LocalRSSRepository(get(), database, account) } @Test - fun synchronizeTest() = runBlocking { + fun synchronizeTest() = runTest { val stream = TestUtils.loadResource("rss_feed.xml") mockServer.enqueue( @@ -90,7 +89,9 @@ class LocalRSSRepositoryTest : KoinTest { } assertTrue { result.first.items.isNotEmpty() } - assertTrue { database.itemDao().itemExists(result.first.items.first().guid!!, account.id) } + assertTrue { + database.newItemDao().itemExists(result.first.items.first().guid!!, account.id) + } } @Test @@ -108,6 +109,8 @@ class LocalRSSRepositoryTest : KoinTest { } assertTrue { result.first.items.isNotEmpty() } - assertTrue { database.itemDao().itemExists(result.first.items.first().guid!!, account.id) } + assertTrue { + database.newItemDao().itemExists(result.first.items.first().guid!!, account.id) + } } } \ No newline at end of file diff --git a/appcompose/src/androidTest/java/com/readrops/app/compose/SyncResultAnalyserTest.kt b/appcompose/src/androidTest/java/com/readrops/app/compose/SyncResultAnalyserTest.kt index a6c5719a..96df84bc 100644 --- a/appcompose/src/androidTest/java/com/readrops/app/compose/SyncResultAnalyserTest.kt +++ b/appcompose/src/androidTest/java/com/readrops/app/compose/SyncResultAnalyserTest.kt @@ -66,7 +66,7 @@ class SyncAnalyzerTest { isNotificationEnabled = i % 2 == 0 } - database.feedDao().insert(feed).subscribe() + database.newFeedDao().insert(feed) } } @@ -92,7 +92,7 @@ class SyncAnalyzerTest { assertEquals("caseOneElementEveryWhere", notificationContent.content) assertEquals("feed 1", notificationContent.title) assertTrue(notificationContent.largeIcon != null) - assertTrue(notificationContent.accountId!! > 0) + assertTrue(notificationContent.accountId > 0) database.newItemDao().delete(item) }