Remove unnecessary return value
Some checks failed
continuous-integration/drone/pr Build is failing

This commit is contained in:
davidoskky 2022-09-30 09:11:55 +02:00
parent 28b950f467
commit 6f60ef4346
2 changed files with 6 additions and 12 deletions

View File

@ -456,17 +456,16 @@ class Repository(private val api: SelfossApi, private val appSettingsService: Ap
db.itemsQueries.updateItem(item.datetime, item.title.getHtmlDecoded(), item.content, item.unread, item.starred, item.thumbnail, item.icon, item.link, item.sourcetitle, item.tags.joinToString(","), item.id.toString())
// TODO: This function should check for duplicate items
suspend fun tryToCacheItemsAndGetNewOnes(): List<SelfossModel.Item> {
suspend fun tryToCacheItemsAndGetNewOnes() {
try {
val newItems = getMaxItemsForBackground(ItemType.UNREAD)
val allItems = getMaxItemsForBackground(ItemType.ALL)
val starredItems = getMaxItemsForBackground(ItemType.STARRED)
insertDBItems(newItems + allItems + starredItems)
return newItems
val fullItemsList = newItems + allItems + starredItems
insertDBItems(fullItemsList)
} catch (e: Throwable) {
// We do nothing
}
return emptyList()
}
// TODO: Add tests

View File

@ -899,9 +899,8 @@ class RepositoryTest() {
"d8c92cdb1ef119ea85c4b9205c879ca7.png"
)
repository.searchFilter = "search"
var items = emptyList<SelfossModel.Item>()
runBlocking {
items = repository.tryToCacheItemsAndGetNewOnes()
repository.tryToCacheItemsAndGetNewOnes()
}
coVerify(exactly = 3) { api.getItems(any(), 0, null, null, null, null, 200) }
@ -923,13 +922,11 @@ class RepositoryTest() {
"d8c92cdb1ef119ea85c4b9205c879ca7.png"
)
repository.searchFilter = "search"
var items = emptyList<SelfossModel.Item>()
runBlocking {
items = repository.tryToCacheItemsAndGetNewOnes()
repository.tryToCacheItemsAndGetNewOnes()
}
coVerify(exactly = 3) { api.getItems(any(), 0, null, null, null, null, 200) }
assertSame(0, items.size)
}
@Test
@ -949,13 +946,11 @@ class RepositoryTest() {
"d8c92cdb1ef119ea85c4b9205c879ca7.png"
)
repository.searchFilter = "search"
var items = emptyList<SelfossModel.Item>()
runBlocking {
items = repository.tryToCacheItemsAndGetNewOnes()
repository.tryToCacheItemsAndGetNewOnes()
}
coVerify(exactly = 0) { api.getItems(any(), 0, null, null, null, null, 200) }
assertSame(emptyList<SelfossModel.Item>(), items)
}
}