From 79615258690ac371041454dfaf3cd2d2928fbb45 Mon Sep 17 00:00:00 2001 From: Maxime NATUREL Date: Mon, 18 Jul 2022 15:02:30 +0200 Subject: [PATCH] Unit tests: adding verification that redaction does not happen when event id is empty --- .../location/RedactLiveLocationShareEventUseCaseTest.kt | 2 ++ .../vector/app/test/fakes/FakeLocationSharingService.kt | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/vector/src/test/java/im/vector/app/features/home/room/detail/location/RedactLiveLocationShareEventUseCaseTest.kt b/vector/src/test/java/im/vector/app/features/home/room/detail/location/RedactLiveLocationShareEventUseCaseTest.kt index 89b619fe3c..2ca285ef50 100644 --- a/vector/src/test/java/im/vector/app/features/home/room/detail/location/RedactLiveLocationShareEventUseCaseTest.kt +++ b/vector/src/test/java/im/vector/app/features/home/room/detail/location/RedactLiveLocationShareEventUseCaseTest.kt @@ -45,5 +45,7 @@ class RedactLiveLocationShareEventUseCaseTest { val event = Event(eventId = "") redactLiveLocationShareEventUseCase.execute(event = event, room = fakeRoom, reason = A_REASON) + + fakeRoom.locationSharingService().verifyRedactLiveLocationShare(inverse = true, beaconInfoEventId = "", reason = A_REASON) } } diff --git a/vector/src/test/java/im/vector/app/test/fakes/FakeLocationSharingService.kt b/vector/src/test/java/im/vector/app/test/fakes/FakeLocationSharingService.kt index d85403a274..ce498a715a 100644 --- a/vector/src/test/java/im/vector/app/test/fakes/FakeLocationSharingService.kt +++ b/vector/src/test/java/im/vector/app/test/fakes/FakeLocationSharingService.kt @@ -56,7 +56,12 @@ class FakeLocationSharingService : LocationSharingService by mockk() { coEvery { redactLiveLocationShare(beaconInfoEventId, reason) } just runs } - fun verifyRedactLiveLocationShare(beaconInfoEventId: String, reason: String?) { - coVerify { redactLiveLocationShare(beaconInfoEventId, reason) } + /** + * @param inverse when true it will check redaction of the live did not happen + * @param beaconInfoEventId event id of the beacon related to the live + * @param reason reason explaining the redaction + */ + fun verifyRedactLiveLocationShare(inverse: Boolean = false, beaconInfoEventId: String, reason: String?) { + coVerify(inverse = inverse) { redactLiveLocationShare(beaconInfoEventId, reason) } } }