mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Description and thumbnail is showing for the categories that are associated with Wikidata (#4803)
* Depiction.commons categories showing with description and thumbnail * Test added * Test added
This commit is contained in:
parent
ecc6b1bf28
commit
15fa93e8d0
5 changed files with 95 additions and 3 deletions
|
|
@ -84,13 +84,16 @@ class CategoriesModelTest {
|
|||
"titleSearch", "", "", false))))
|
||||
whenever(categoryDao.recentCategories(25)).thenReturn(listOf(CategoryItem(
|
||||
"recentCategories","","", false)))
|
||||
whenever(categoryClient.getCategoriesByName("depictionCategory",
|
||||
"depictionCategory", 25)).thenReturn(Single.just(listOf(CategoryItem(
|
||||
"commonsCategories","","", false))))
|
||||
val imageTitleList = listOf("Test")
|
||||
CategoriesModel(categoryClient, categoryDao, gpsCategoryModel)
|
||||
.searchAll("", imageTitleList, listOf(depictedItem))
|
||||
.test()
|
||||
.assertValue(
|
||||
listOf(
|
||||
categoryItem("depictionCategory"),
|
||||
categoryItem("commonsCategories"),
|
||||
categoryItem("gpsCategory"),
|
||||
categoryItem("titleSearch"),
|
||||
categoryItem("recentCategories")
|
||||
|
|
|
|||
|
|
@ -77,6 +77,40 @@ class CategoryClientTest {
|
|||
.test()
|
||||
.assertValues(emptyList())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCategoriesByNameFound() {
|
||||
val mockResponse = withMockResponse("Category:Test")
|
||||
whenever(categoryInterface.getCategoriesByName(anyString(), anyString(),
|
||||
anyInt(), anyInt()))
|
||||
.thenReturn(Single.just(mockResponse))
|
||||
categoryClient.getCategoriesByName("tes", "tes", 10)
|
||||
.test()
|
||||
.assertValues(listOf(CategoryItem("Test", "",
|
||||
"", false)))
|
||||
categoryClient.getCategoriesByName("tes" , "tes",
|
||||
10, 10)
|
||||
.test()
|
||||
.assertValues(listOf(CategoryItem("Test", "",
|
||||
"", false)))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCategoriesByNameNull() {
|
||||
val mockResponse = withNullPages()
|
||||
whenever(categoryInterface.getCategoriesByName(anyString(), anyString(),
|
||||
anyInt(), anyInt()))
|
||||
.thenReturn(Single.just(mockResponse))
|
||||
categoryClient.getCategoriesByName("tes", "tes",
|
||||
10)
|
||||
.test()
|
||||
.assertValues(emptyList())
|
||||
categoryClient.getCategoriesByName("tes", "tes",
|
||||
10, 10)
|
||||
.test()
|
||||
.assertValues(emptyList())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getParentCategoryListFound() {
|
||||
val mockResponse = withMockResponse("Category:Test")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue