Null values are treated as "not hidden".

This commit is contained in:
sonalyadav 2024-12-19 18:54:21 +05:30 committed by Sonal Yadav
parent e78447d406
commit 75c1717c89

View file

@ -16,10 +16,10 @@ const val CATEGORY_NEEDING_CATEGORIES = "needing categories"
*/
@Singleton
class CategoryClient
@Inject
constructor(
@Inject
constructor(
private val categoryInterface: CategoryInterface,
) : ContinuationClient<MwQueryResponse, CategoryItem>() {
) : ContinuationClient<MwQueryResponse, CategoryItem>() {
/**
* Searches for categories containing the specified string.
*
@ -124,9 +124,8 @@ class CategoryClient
}.map {
it
.filter { page ->
// Null check is not redundant because some values could be null
// for mocks when running unit tests
page.categoryInfo()?.isHidden != true
// Null values are treated as "not hidden" for unit test mocks
!(page.categoryInfo()?.isHidden ?: false)
}.map {
CategoryItem(
it.title().replace(CATEGORY_PREFIX, ""),
@ -136,4 +135,4 @@ class CategoryClient
)
}
}
}
}