mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Update allowed recent years to include 2020s (#5761)
* document regex due to #47
* also count 2020s as "recent years"
* clarify that not all years are ignored
* clarify "year" is current year
* original logic fix
from https://github.com/commons-app/apps-android-commons/pull/5761#pullrequestreview-2144120347
* better variale name for ".*0s.*"
as that regex will match e.g. `1920s` and `80s` too, so the original `is20xxsYear` would be confusing name for it
* consolidate duplicated code to spammyCategory
* clarify regexes via variables
* spammyCategory should always be skipped
* return is simple now, so we can get rid of extra val oldDecade
* fix curYearInString
* some clarification comments
* refactor: rename containsYear to isSpammyCategory
This is done as the name containsYear is ambiguous.
It not just checks for year to identify spammy categories.
* refactor: rename containsYear to isSpammyCategory (take 2)
A continuation of fe74c77ab (refactor: rename containsYear
to isSpammyCategory, 2024-07-17)
---------
Co-authored-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
This commit is contained in:
parent
34addbe33a
commit
7f6b45aeb6
5 changed files with 36 additions and 25 deletions
|
|
@ -14,7 +14,6 @@ import media
|
|||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.mockito.Mock
|
||||
import org.mockito.Mockito.verifyNoInteractions
|
||||
import org.mockito.MockitoAnnotations
|
||||
import java.lang.reflect.Method
|
||||
|
||||
|
|
@ -97,8 +96,8 @@ class CategoriesPresenterTest {
|
|||
)
|
||||
)
|
||||
)
|
||||
whenever(repository.containsYear("selected")).thenReturn(false)
|
||||
whenever(repository.containsYear("doesContainYear")).thenReturn(true)
|
||||
whenever(repository.isSpammyCategory("selected")).thenReturn(false)
|
||||
whenever(repository.isSpammyCategory("doesContainYear")).thenReturn(true)
|
||||
whenever(repository.selectedCategories).thenReturn(listOf(
|
||||
categoryItem("selected", "", "",true)))
|
||||
categoriesPresenter.searchForCategories("test")
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ class UploadRepositoryUnitTest {
|
|||
@Test
|
||||
fun testContainsYear() {
|
||||
assertEquals(
|
||||
repository.containsYear(""), categoriesModel.containsYear("")
|
||||
repository.isSpammyCategory(""), categoriesModel.isSpammyCategory("")
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue