fixing previous false positive
This commit is contained in:
parent
d28ea9c67f
commit
67be48a48e
|
@ -29,7 +29,7 @@ class ExpectTest(override val coroutineContext: CoroutineContext) : ExpectTestSc
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun <T> T.expect(times: Int, block: suspend MockKMatcherScope.(T) -> Unit) {
|
override fun <T> 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) })
|
expects.add(times to { block(this@expect) })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@ import io.mockk.every
|
||||||
import io.mockk.mockk
|
import io.mockk.mockk
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import test.delegateReturn
|
import test.delegateReturn
|
||||||
import test.expect
|
|
||||||
import test.runExpectTest
|
import test.runExpectTest
|
||||||
|
|
||||||
private const val SUMMARY_ID = 101
|
private const val SUMMARY_ID = 101
|
||||||
|
@ -45,12 +44,13 @@ class NotificationRendererTest {
|
||||||
@Test
|
@Test
|
||||||
fun `given removed rooms when rendering then cancels notifications with cancelled room ids`() = runExpectTest {
|
fun `given removed rooms when rendering then cancels notifications with cancelled room ids`() = runExpectTest {
|
||||||
val removedRooms = setOf(aRoomId("id-1"), aRoomId("id-2"))
|
val removedRooms = setOf(aRoomId("id-1"), aRoomId("id-2"))
|
||||||
fakeNotificationFactory.instance.expect { it.mapToNotifications(NotificationState(emptyMap(), removedRooms, emptySet(), emptySet())) }
|
val state = aNotificationState(removedRooms = removedRooms)
|
||||||
fakeNotificationManager.instance.expectUnit {
|
fakeNotificationFactory.givenNotifications(state).returns(aNotifications())
|
||||||
removedRooms.forEach { removedRoom -> it.cancel(removedRoom.value, ROOM_MESSAGE_ID) }
|
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()
|
verifyExpects()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue