From 0e96d313ec69eadbf20f1c460ff5dc96bf230ccc Mon Sep 17 00:00:00 2001 From: davidoskky Date: Thu, 29 Sep 2022 19:09:09 +0200 Subject: [PATCH] Add tags parameters explicitly --- .../apps/readerforselfossv2/repository/RepositoryTest.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/shared/src/commonTest/kotlin/bou/amine/apps/readerforselfossv2/repository/RepositoryTest.kt b/shared/src/commonTest/kotlin/bou/amine/apps/readerforselfossv2/repository/RepositoryTest.kt index 3a9a27e..567dbd6 100644 --- a/shared/src/commonTest/kotlin/bou/amine/apps/readerforselfossv2/repository/RepositoryTest.kt +++ b/shared/src/commonTest/kotlin/bou/amine/apps/readerforselfossv2/repository/RepositoryTest.kt @@ -308,6 +308,8 @@ class RepositoryTest() { coEvery { api.tags() } returns SelfossModel.StatusAndData(success = true, data = tags) coEvery { db.tagsQueries.tags().executeAsList() } returns tagsDB + every { appSettingsService.isUpdateSourcesEnabled() } returns true + every { appSettingsService.isItemCachingEnabled() } returns true val repository = Repository(api, appSettingsService, connectivityStatus, db) var testTags: List? = null @@ -330,6 +332,7 @@ class RepositoryTest() { coEvery { api.tags() } returns SelfossModel.StatusAndData(success = true, data = tags) coEvery { db.tagsQueries.tags().executeAsList() } returns tagsDB every { appSettingsService.isUpdateSourcesEnabled() } returns false + every { appSettingsService.isItemCachingEnabled() } returns true val repository = Repository(api, appSettingsService, connectivityStatus, db) var testTags: List = emptyList() @@ -378,6 +381,8 @@ class RepositoryTest() { coEvery { api.tags() } returns SelfossModel.StatusAndData(success = true, data = tags) coEvery { db.tagsQueries.tags().executeAsList() } returns tagsDB every { connectivityStatus.isNetworkConnected } returns MutableStateFlow(false) + every { appSettingsService.isUpdateSourcesEnabled() } returns true + every { appSettingsService.isItemCachingEnabled() } returns true val repository = Repository(api, appSettingsService, connectivityStatus, db) var testTags: List = emptyList() @@ -386,7 +391,7 @@ class RepositoryTest() { } assertNotSame(tags, testTags) - assertSame(tagsDB.first().name, testTags.first().tag) + assertContentEquals(tagsDB.map { it.toView() }, testTags) coVerify(exactly = 0) { api.tags() } verify(atLeast = 1) { db.tagsQueries.tags().executeAsList() } } @@ -402,6 +407,7 @@ class RepositoryTest() { coEvery { db.tagsQueries.tags().executeAsList() } returns tagsDB every { connectivityStatus.isNetworkConnected } returns MutableStateFlow(false) every { appSettingsService.isItemCachingEnabled() } returns false + every { appSettingsService.isUpdateSourcesEnabled() } returns true val repository = Repository(api, appSettingsService, connectivityStatus, db) var testTags: List = emptyList() @@ -425,6 +431,7 @@ class RepositoryTest() { coEvery { db.tagsQueries.tags().executeAsList() } returns tagsDB every { connectivityStatus.isNetworkConnected } returns MutableStateFlow(false) every { appSettingsService.isUpdateSourcesEnabled() } returns false + every { appSettingsService.isItemCachingEnabled() } returns true val repository = Repository(api, appSettingsService, connectivityStatus, db) var testTags: List = emptyList()