From a5e3bf3fea561c39c9e6eab215e86e448d7fbf12 Mon Sep 17 00:00:00 2001 From: Igor Bubelov Date: Wed, 17 Apr 2024 14:58:34 +0700 Subject: [PATCH] Fix tests --- app/src/test/kotlin/feeds/FeedsModelTest.kt | 3 +++ app/src/test/kotlin/feeds/FeedsRepositoryTest.kt | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/test/kotlin/feeds/FeedsModelTest.kt b/app/src/test/kotlin/feeds/FeedsModelTest.kt index 3cb152a9..4fb53384 100644 --- a/app/src/test/kotlin/feeds/FeedsModelTest.kt +++ b/app/src/test/kotlin/feeds/FeedsModelTest.kt @@ -2,6 +2,7 @@ package feeds import conf.ConfRepo import db.testDb +import entries.EntriesRepo import io.mockk.mockk import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.filterIsInstance @@ -34,10 +35,12 @@ class FeedsModelTest { val db = testDb() val confRepo = ConfRepo(db) val feedsRepo = FeedsRepo(mockk(), db) + val entriesRepo = EntriesRepo(mockk(), db) val model = FeedsModel( confRepo = confRepo, feedsRepo = feedsRepo, + entriesRepo = entriesRepo, ) withTimeout(1000) { diff --git a/app/src/test/kotlin/feeds/FeedsRepositoryTest.kt b/app/src/test/kotlin/feeds/FeedsRepositoryTest.kt index d9db788e..5e8edd59 100644 --- a/app/src/test/kotlin/feeds/FeedsRepositoryTest.kt +++ b/app/src/test/kotlin/feeds/FeedsRepositoryTest.kt @@ -1,6 +1,7 @@ package feeds import api.Api +import db.Entry import db.Feed import db.insertRandomFeed import db.testDb @@ -54,7 +55,11 @@ class FeedsRepositoryTest { ext_show_preview_images = null, ) - coEvery { api.addFeed(feedUrl) } returns Result.success(feed) + val entries = listOf() + + val res = Pair(feed, entries) + + coEvery { api.addFeed(feedUrl) } returns Result.success(res) repo.insertByUrl(feedUrl)