Repository Unit Tests #50

Merged
AmineB merged 38 commits from davidoskky/ReaderForSelfoss-multiplatform:repository_tests into master 2022-09-30 11:31:55 +00:00
2 changed files with 0 additions and 4 deletions
Showing only changes of commit 27bb056397 - Show all commits

View File

@ -249,7 +249,6 @@ class ArticleFragment : Fragment(), DIAware {
private fun getContentFromMercury() {
if (repository.isNetworkAvailable()) {
binding.progressBar.visibility = View.VISIBLE
// TODO: The api should be accessed through the repository
val parser = MercuryApi()
AmineB marked this conversation as resolved Outdated

Please remove this comment.

Please remove this comment.
parser.parseUrl(url).enqueue(

View File

@ -403,8 +403,6 @@ class Repository(private val api: SelfossApi, private val appSettingsService: Ap
}
}
// TODO: This should be private (since all api calls are made through the repository
// no other entity needs to know about the connectivity status)
fun isNetworkAvailable() = isConnectionAvailable.value && !offlineOverride
AmineB marked this conversation as resolved Outdated

Because of the mercury api using this, can you remove this comment, please ?

Because of the mercury api using this, can you remove this comment, please ?
private fun getDBActions(): List<ACTION> =
@ -458,7 +456,6 @@ class Repository(private val api: SelfossApi, private val appSettingsService: Ap
// TODO: This function should check for duplicate items
suspend fun tryToCacheItemsAndGetNewOnes(): List<SelfossModel.Item> {
try {
AmineB marked this conversation as resolved Outdated

I think that the DB handles the duplicates.

I think that the DB handles the duplicates.

Does it use the id to check for duplicates? If that is the case then all is good.

Does it use the id to check for duplicates? If that is the case then all is good.
val previousNewItems = getDBItems().count { it.unread }
val newItems = getMaxItemsForBackground(ItemType.UNREAD)
val allItems = getMaxItemsForBackground(ItemType.ALL)
val starredItems = getMaxItemsForBackground(ItemType.STARRED)
AmineB marked this conversation as resolved Outdated

This is useless.

This is useless.