mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
* fix issue with item with endtime shown as existing * Removed destroyed and endtime, Added comments and also fixed the broken tests * minor fix * Added comments * fix no such column location_exists error * minor improvement Co-authored-by: Pratham2305 <Pratham2305@users.noreply.github.com>
This commit is contained in:
parent
d00127947c
commit
944225c3a3
10 changed files with 53 additions and 28 deletions
|
|
@ -83,9 +83,9 @@ fun place(
|
|||
category: String = "category",
|
||||
siteLinks: Sitelinks? = null,
|
||||
pic: String = "pic",
|
||||
destroyed: String = "destroyed"
|
||||
exists: Boolean = false
|
||||
): Place {
|
||||
return Place(lang, name, label, longDescription, latLng, category, siteLinks, pic, destroyed)
|
||||
return Place(lang, name, label, longDescription, latLng, category, siteLinks, pic, exists)
|
||||
}
|
||||
|
||||
fun entityId(wikiBaseEntityValue: WikiBaseEntityValue = wikiBaseEntityValue()) =
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class BookMarkLocationDaoTest {
|
|||
COLUMN_LAT,
|
||||
COLUMN_LONG,
|
||||
COLUMN_PIC,
|
||||
COLUMN_DESTROYED)
|
||||
COLUMN_EXISTS)
|
||||
private val client: ContentProviderClient = mock()
|
||||
private val database: SQLiteDatabase = mock()
|
||||
private val captor = argumentCaptor<ContentValues>()
|
||||
|
|
@ -63,7 +63,7 @@ class BookMarkLocationDaoTest {
|
|||
|
||||
|
||||
examplePlaceBookmark = Place("en", "placeName", exampleLabel, "placeDescription"
|
||||
, exampleLocation, "placeCategory", builder.build(),"picName","placeDestroyed")
|
||||
, exampleLocation, "placeCategory", builder.build(),"picName",false)
|
||||
testObject = BookmarkLocationsDao { client }
|
||||
}
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ class BookMarkLocationDaoTest {
|
|||
assertEquals(builder.build().wikidataLink, it.siteLinks.wikidataLink)
|
||||
assertEquals(builder.build().commonsLink, it.siteLinks.commonsLink)
|
||||
assertEquals("picName",it.pic)
|
||||
assertEquals("placeDestroyed", it.destroyed)
|
||||
assertEquals(false, it.exists)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -163,7 +163,7 @@ class BookMarkLocationDaoTest {
|
|||
assertEquals(examplePlaceBookmark.siteLinks.wikidataLink.toString(), cv.getAsString(COLUMN_WIKIDATA_LINK))
|
||||
assertEquals(examplePlaceBookmark.siteLinks.commonsLink.toString(), cv.getAsString(COLUMN_COMMONS_LINK))
|
||||
assertEquals(examplePlaceBookmark.pic.toString(), cv.getAsString(COLUMN_PIC))
|
||||
assertEquals(examplePlaceBookmark.destroyed.toString(), cv.getAsString(COLUMN_DESTROYED))
|
||||
assertEquals(examplePlaceBookmark.exists.toString(), cv.getAsString(COLUMN_EXISTS))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -271,13 +271,19 @@ class BookMarkLocationDaoTest {
|
|||
verify(database).execSQL("ALTER TABLE bookmarksLocations ADD COLUMN location_language STRING;")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun migrateTableVersionFrom_v14_to_v15() {
|
||||
onUpdate(database, 14, 15)
|
||||
verify(database).execSQL("ALTER TABLE bookmarksLocations ADD COLUMN location_exists STRING;")
|
||||
}
|
||||
|
||||
|
||||
private fun createCursor(rowCount: Int) = MatrixCursor(columns, rowCount).apply {
|
||||
|
||||
for (i in 0 until rowCount) {
|
||||
addRow(listOf("placeName", "en", "placeDescription", "placeCategory", exampleLabel.text, exampleLabel.icon,
|
||||
exampleUri, builder.build().wikipediaLink, builder.build().wikidataLink, builder.build().commonsLink,
|
||||
exampleLocation.latitude, exampleLocation.longitude, "picName", "placeDestroyed"))
|
||||
exampleLocation.latitude, exampleLocation.longitude, "picName", "placeExists"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ class BookmarkLocationControllerTest {
|
|||
private val mockBookmarkList: List<Place>
|
||||
private get() {
|
||||
val list = ArrayList<Place>()
|
||||
list.add(Place("en","a place",null,"a description",null,"a cat",null,null,null))
|
||||
list.add(Place("en","another place",null,"another description",null,"another cat",null,null,null))
|
||||
list.add(Place("en","a place",null,"a description",null,"a cat",null,null,true))
|
||||
list.add(Place("en","another place",null,"another description",null,"another cat",null,null,true))
|
||||
return list
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue