Skip to content

Commit 7961525

Browse files
author
Maxime NATUREL
committed
Unit tests: adding verification that redaction does not happen when event id is empty
1 parent 2121ec5 commit 7961525

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

vector/src/test/java/im/vector/app/features/home/room/detail/location/RedactLiveLocationShareEventUseCaseTest.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,7 @@ class RedactLiveLocationShareEventUseCaseTest {
4545
val event = Event(eventId = "")
4646

4747
redactLiveLocationShareEventUseCase.execute(event = event, room = fakeRoom, reason = A_REASON)
48+
49+
fakeRoom.locationSharingService().verifyRedactLiveLocationShare(inverse = true, beaconInfoEventId = "", reason = A_REASON)
4850
}
4951
}

vector/src/test/java/im/vector/app/test/fakes/FakeLocationSharingService.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@ class FakeLocationSharingService : LocationSharingService by mockk() {
5656
coEvery { redactLiveLocationShare(beaconInfoEventId, reason) } just runs
5757
}
5858

59-
fun verifyRedactLiveLocationShare(beaconInfoEventId: String, reason: String?) {
60-
coVerify { redactLiveLocationShare(beaconInfoEventId, reason) }
59+
/**
60+
* @param inverse when true it will check redaction of the live did not happen
61+
* @param beaconInfoEventId event id of the beacon related to the live
62+
* @param reason reason explaining the redaction
63+
*/
64+
fun verifyRedactLiveLocationShare(inverse: Boolean = false, beaconInfoEventId: String, reason: String?) {
65+
coVerify(inverse = inverse) { redactLiveLocationShare(beaconInfoEventId, reason) }
6166
}
6267
}

0 commit comments

Comments
 (0)