diff --git a/core/src/testFixtures/kotlin/test/ExpectTestScope.kt b/core/src/testFixtures/kotlin/test/ExpectTestScope.kt index 24dc40f..bff2b8f 100644 --- a/core/src/testFixtures/kotlin/test/ExpectTestScope.kt +++ b/core/src/testFixtures/kotlin/test/ExpectTestScope.kt @@ -29,7 +29,7 @@ class ExpectTest(override val coroutineContext: CoroutineContext) : ExpectTestSc } override fun T.expect(times: Int, block: suspend MockKMatcherScope.(T) -> Unit) { - coJustRun { block(this@expect) }.ignore() + coJustRun { block(this@expect) } expects.add(times to { block(this@expect) }) } diff --git a/features/notifications/src/test/kotlin/app/dapk/st/notifications/NotificationRendererTest.kt b/features/notifications/src/test/kotlin/app/dapk/st/notifications/NotificationRendererTest.kt index 724aa50..6875205 100644 --- a/features/notifications/src/test/kotlin/app/dapk/st/notifications/NotificationRendererTest.kt +++ b/features/notifications/src/test/kotlin/app/dapk/st/notifications/NotificationRendererTest.kt @@ -15,7 +15,6 @@ import io.mockk.every import io.mockk.mockk import org.junit.Test import test.delegateReturn -import test.expect import test.runExpectTest private const val SUMMARY_ID = 101 @@ -45,12 +44,13 @@ class NotificationRendererTest { @Test fun `given removed rooms when rendering then cancels notifications with cancelled room ids`() = runExpectTest { val removedRooms = setOf(aRoomId("id-1"), aRoomId("id-2")) - fakeNotificationFactory.instance.expect { it.mapToNotifications(NotificationState(emptyMap(), removedRooms, emptySet(), emptySet())) } - fakeNotificationManager.instance.expectUnit { - removedRooms.forEach { removedRoom -> it.cancel(removedRoom.value, ROOM_MESSAGE_ID) } - } + val state = aNotificationState(removedRooms = removedRooms) + fakeNotificationFactory.givenNotifications(state).returns(aNotifications()) + fakeNotificationManager.instance.expectUnit { removedRooms.forEach { removedRoom -> it.cancel(removedRoom.value, ROOM_MESSAGE_ID) } } + fakeNotificationManager.instance.expectUnit { it.cancel(SUMMARY_ID) } + + notificationRenderer.render(state) - notificationRenderer.render(NotificationState(emptyMap(), removedRooms, emptySet(), emptySet())) verifyExpects() }