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:
Ayan Sarkar 2022-02-14 16:15:59 +05:30 committed by GitHub
parent ecc6b1bf28
commit 15fa93e8d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 95 additions and 3 deletions

View file

@ -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")

View file

@ -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")