Apply review
This commit is contained in:
parent
f9cdb8e0cf
commit
cda0e0c57b
1 changed files with 11 additions and 5 deletions
|
|
@ -13,6 +13,7 @@ import org.junit.Assert.assertNull
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
|
import org.schabi.newpipe.extractor.ServiceList
|
||||||
import org.schabi.newpipe.extractor.stream.StreamType
|
import org.schabi.newpipe.extractor.stream.StreamType
|
||||||
|
|
||||||
@RunWith(AndroidJUnit4::class)
|
@RunWith(AndroidJUnit4::class)
|
||||||
|
|
@ -26,7 +27,7 @@ class DatabaseMigrationTest {
|
||||||
private const val DEFAULT_UPLOADER_NAME = "Uploader Test"
|
private const val DEFAULT_UPLOADER_NAME = "Uploader Test"
|
||||||
private const val DEFAULT_THUMBNAIL = "https://example.com/example.jpg"
|
private const val DEFAULT_THUMBNAIL = "https://example.com/example.jpg"
|
||||||
|
|
||||||
private const val DEFAULT_SECOND_SERVICE_ID = 1
|
private const val DEFAULT_SECOND_SERVICE_ID = 0
|
||||||
private const val DEFAULT_SECOND_URL = "https://www.youtube.com/watch?v=ncQU6iBn5Fc"
|
private const val DEFAULT_SECOND_URL = "https://www.youtube.com/watch?v=ncQU6iBn5Fc"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -155,32 +156,37 @@ class DatabaseMigrationTest {
|
||||||
val defaultSearch1 = " abc "
|
val defaultSearch1 = " abc "
|
||||||
val defaultSearch2 = " abc"
|
val defaultSearch2 = " abc"
|
||||||
|
|
||||||
|
val serviceId = DEFAULT_SERVICE_ID // YouTube
|
||||||
|
// Use id different to YouTube because two searches with the same query
|
||||||
|
// but different service are considered not equal.
|
||||||
|
val otherServiceId = ServiceList.SoundCloud.serviceId
|
||||||
|
|
||||||
databaseInV7.run {
|
databaseInV7.run {
|
||||||
insert(
|
insert(
|
||||||
"search_history", SQLiteDatabase.CONFLICT_FAIL,
|
"search_history", SQLiteDatabase.CONFLICT_FAIL,
|
||||||
ContentValues().apply {
|
ContentValues().apply {
|
||||||
put("service_id", DEFAULT_SERVICE_ID)
|
put("service_id", serviceId)
|
||||||
put("search", defaultSearch1)
|
put("search", defaultSearch1)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
insert(
|
insert(
|
||||||
"search_history", SQLiteDatabase.CONFLICT_FAIL,
|
"search_history", SQLiteDatabase.CONFLICT_FAIL,
|
||||||
ContentValues().apply {
|
ContentValues().apply {
|
||||||
put("service_id", DEFAULT_SERVICE_ID)
|
put("service_id", serviceId)
|
||||||
put("search", defaultSearch2)
|
put("search", defaultSearch2)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
insert(
|
insert(
|
||||||
"search_history", SQLiteDatabase.CONFLICT_FAIL,
|
"search_history", SQLiteDatabase.CONFLICT_FAIL,
|
||||||
ContentValues().apply {
|
ContentValues().apply {
|
||||||
put("service_id", DEFAULT_SECOND_SERVICE_ID)
|
put("service_id", otherServiceId)
|
||||||
put("search", defaultSearch1)
|
put("search", defaultSearch1)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
insert(
|
insert(
|
||||||
"search_history", SQLiteDatabase.CONFLICT_FAIL,
|
"search_history", SQLiteDatabase.CONFLICT_FAIL,
|
||||||
ContentValues().apply {
|
ContentValues().apply {
|
||||||
put("service_id", DEFAULT_SECOND_SERVICE_ID)
|
put("service_id", otherServiceId)
|
||||||
put("search", defaultSearch2)
|
put("search", defaultSearch2)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue