mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-29 05:43:55 +01:00
Add unit test for #4901 fix.
This commit is contained in:
parent
64a54ec09b
commit
d89b93661f
1 changed files with 20 additions and 0 deletions
|
|
@ -154,6 +154,26 @@ class CategoryClientTest {
|
|||
.assertValues(emptyList())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun checkIrrelevantCategoryIsFilteredOut() {
|
||||
val mockResponse = withMockResponse("Category:Photographs taken on 2015-11-08")
|
||||
whenever(categoryInterface.searchCategories(anyString(), anyInt(), anyInt()))
|
||||
.thenReturn(Single.just(mockResponse))
|
||||
categoryClient.searchCategories("Photo", 10)
|
||||
.test()
|
||||
.assertValues(emptyList())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun checkNotAllCategoriesWithDateAreFilteredOut() {
|
||||
val mockResponse = withMockResponse("Category:Amavenita (ship, 2014)")
|
||||
whenever(categoryInterface.searchCategories(anyString(), anyInt(), anyInt()))
|
||||
.thenReturn(Single.just(mockResponse))
|
||||
categoryClient.searchCategories("Amav", 10)
|
||||
.test()
|
||||
.assertValues(emptyList())
|
||||
}
|
||||
|
||||
private fun withMockResponse(title: String): MwQueryResponse? {
|
||||
val mwQueryPage: MwQueryPage = mock()
|
||||
whenever(mwQueryPage.title()).thenReturn(title)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue