mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-03-18 04:08:44 +03:00
Unit test for live location sending
This commit is contained in:
parent
7332c08bb4
commit
fb7fbced39
1 changed files with 21 additions and 1 deletions
|
@ -36,6 +36,7 @@ import org.matrix.android.sdk.test.fakes.givenIsNotEmpty
|
|||
import org.matrix.android.sdk.test.fakes.givenIsNotNull
|
||||
|
||||
private const val A_ROOM_ID = "room_id"
|
||||
private const val AN_EVENT_ID = "event_id"
|
||||
private const val A_LATITUDE = 1.4
|
||||
private const val A_LONGITUDE = 40.0
|
||||
private const val AN_UNCERTAINTY = 5.0
|
||||
|
@ -91,7 +92,26 @@ internal class DefaultLocationSharingServiceTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `live location can be sent`() {
|
||||
fun `live location can be sent`() = runTest {
|
||||
val cancelable = mockk<Cancelable>()
|
||||
coEvery { sendLiveLocationTask.execute(any()) } returns cancelable
|
||||
|
||||
val result = defaultLocationSharingService.sendLiveLocation(
|
||||
beaconInfoEventId = AN_EVENT_ID,
|
||||
latitude = A_LATITUDE,
|
||||
longitude = A_LONGITUDE,
|
||||
uncertainty = AN_UNCERTAINTY
|
||||
)
|
||||
|
||||
result shouldBeEqualTo cancelable
|
||||
val expectedParams = SendLiveLocationTask.Params(
|
||||
roomId = A_ROOM_ID,
|
||||
beaconInfoEventId = AN_EVENT_ID,
|
||||
latitude = A_LATITUDE,
|
||||
longitude = A_LONGITUDE,
|
||||
uncertainty = AN_UNCERTAINTY
|
||||
)
|
||||
coVerify { sendLiveLocationTask.execute(expectedParams) }
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Add table
Reference in a new issue