16
16
17
17
package org.matrix.android.sdk.session.search
18
18
19
+ import org.amshove.kluent.shouldBeEqualTo
19
20
import org.junit.Assert.assertTrue
20
21
import org.junit.FixMethodOrder
21
22
import org.junit.Test
@@ -43,7 +44,7 @@ class SearchMessagesTest : InstrumentedTest {
43
44
cryptoTestData.firstSession
44
45
.searchService()
45
46
.search(
46
- searchTerm = " lore " ,
47
+ searchTerm = " lorem " ,
47
48
limit = 10 ,
48
49
includeProfile = true ,
49
50
afterLimit = 0 ,
@@ -61,7 +62,7 @@ class SearchMessagesTest : InstrumentedTest {
61
62
cryptoTestData.firstSession
62
63
.searchService()
63
64
.search(
64
- searchTerm = " lore " ,
65
+ searchTerm = " lorem " ,
65
66
roomId = cryptoTestData.roomId,
66
67
limit = 10 ,
67
68
includeProfile = true ,
@@ -73,7 +74,28 @@ class SearchMessagesTest : InstrumentedTest {
73
74
}
74
75
}
75
76
76
- private fun doTest (block : suspend (CryptoTestData ) -> SearchResult ) = runCryptoTest(context()) { cryptoTestHelper, commonTestHelper ->
77
+ @Test
78
+ fun sendTextMessageAndSearchPartOfItIncompleteWord () {
79
+ doTest(expectedNumberOfResult = 0 ) { cryptoTestData ->
80
+ cryptoTestData.firstSession
81
+ .searchService()
82
+ .search(
83
+ searchTerm = " lore" , /* incomplete word */
84
+ roomId = cryptoTestData.roomId,
85
+ limit = 10 ,
86
+ includeProfile = true ,
87
+ afterLimit = 0 ,
88
+ beforeLimit = 10 ,
89
+ orderByRecent = true ,
90
+ nextBatch = null
91
+ )
92
+ }
93
+ }
94
+
95
+ private fun doTest (
96
+ expectedNumberOfResult : Int = 2,
97
+ block : suspend (CryptoTestData ) -> SearchResult ,
98
+ ) = runCryptoTest(context()) { cryptoTestHelper, commonTestHelper ->
77
99
val cryptoTestData = cryptoTestHelper.doE2ETestWithAliceInARoom(false )
78
100
val aliceSession = cryptoTestData.firstSession
79
101
val aliceRoomId = cryptoTestData.roomId
@@ -87,7 +109,7 @@ class SearchMessagesTest : InstrumentedTest {
87
109
88
110
val data = block.invoke(cryptoTestData)
89
111
90
- assertTrue( data.results?.size == 2 )
112
+ data.results?.size shouldBeEqualTo expectedNumberOfResult
91
113
assertTrue(
92
114
data.results
93
115
?.all {
0 commit comments