Merge branch 'develop' into feature/ons/toggle_ip_address_visibility
This commit is contained in:
commit
6f997e8a0f
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package org.matrix.android.sdk.session.search
|
package org.matrix.android.sdk.session.search
|
||||||
|
|
||||||
|
import org.amshove.kluent.shouldBeEqualTo
|
||||||
import org.junit.Assert.assertTrue
|
import org.junit.Assert.assertTrue
|
||||||
import org.junit.FixMethodOrder
|
import org.junit.FixMethodOrder
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@ -43,7 +44,7 @@ class SearchMessagesTest : InstrumentedTest {
|
|||||||
cryptoTestData.firstSession
|
cryptoTestData.firstSession
|
||||||
.searchService()
|
.searchService()
|
||||||
.search(
|
.search(
|
||||||
searchTerm = "lore",
|
searchTerm = "lorem",
|
||||||
limit = 10,
|
limit = 10,
|
||||||
includeProfile = true,
|
includeProfile = true,
|
||||||
afterLimit = 0,
|
afterLimit = 0,
|
||||||
@ -61,7 +62,7 @@ class SearchMessagesTest : InstrumentedTest {
|
|||||||
cryptoTestData.firstSession
|
cryptoTestData.firstSession
|
||||||
.searchService()
|
.searchService()
|
||||||
.search(
|
.search(
|
||||||
searchTerm = "lore",
|
searchTerm = "lorem",
|
||||||
roomId = cryptoTestData.roomId,
|
roomId = cryptoTestData.roomId,
|
||||||
limit = 10,
|
limit = 10,
|
||||||
includeProfile = true,
|
includeProfile = true,
|
||||||
@ -73,7 +74,28 @@ class SearchMessagesTest : InstrumentedTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun doTest(block: suspend (CryptoTestData) -> SearchResult) = runCryptoTest(context()) { cryptoTestHelper, commonTestHelper ->
|
@Test
|
||||||
|
fun sendTextMessageAndSearchPartOfItIncompleteWord() {
|
||||||
|
doTest(expectedNumberOfResult = 0) { cryptoTestData ->
|
||||||
|
cryptoTestData.firstSession
|
||||||
|
.searchService()
|
||||||
|
.search(
|
||||||
|
searchTerm = "lore", /* incomplete word */
|
||||||
|
roomId = cryptoTestData.roomId,
|
||||||
|
limit = 10,
|
||||||
|
includeProfile = true,
|
||||||
|
afterLimit = 0,
|
||||||
|
beforeLimit = 10,
|
||||||
|
orderByRecent = true,
|
||||||
|
nextBatch = null
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun doTest(
|
||||||
|
expectedNumberOfResult: Int = 2,
|
||||||
|
block: suspend (CryptoTestData) -> SearchResult,
|
||||||
|
) = runCryptoTest(context()) { cryptoTestHelper, commonTestHelper ->
|
||||||
val cryptoTestData = cryptoTestHelper.doE2ETestWithAliceInARoom(false)
|
val cryptoTestData = cryptoTestHelper.doE2ETestWithAliceInARoom(false)
|
||||||
val aliceSession = cryptoTestData.firstSession
|
val aliceSession = cryptoTestData.firstSession
|
||||||
val aliceRoomId = cryptoTestData.roomId
|
val aliceRoomId = cryptoTestData.roomId
|
||||||
@ -87,7 +109,7 @@ class SearchMessagesTest : InstrumentedTest {
|
|||||||
|
|
||||||
val data = block.invoke(cryptoTestData)
|
val data = block.invoke(cryptoTestData)
|
||||||
|
|
||||||
assertTrue(data.results?.size == 2)
|
data.results?.size shouldBeEqualTo expectedNumberOfResult
|
||||||
assertTrue(
|
assertTrue(
|
||||||
data.results
|
data.results
|
||||||
?.all {
|
?.all {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user