Add missing test on reset methods.

This commit is contained in:
Benoit Marty 2024-09-04 10:57:14 +02:00
parent a81448c243
commit 9e60fa9367
9 changed files with 93 additions and 1 deletions

View file

@ -84,6 +84,35 @@ class UnifiedPushTestTest {
}
}
@Test
fun `test UnifiedPushTest error and reset`() = runTest {
val providers = FakeUnifiedPushDistributorProvider()
val sut = UnifiedPushTest(
unifiedPushDistributorProvider = providers,
openDistributorWebPageAction = FakeOpenDistributorWebPageAction(
executeAction = {
providers.setDistributorsResult(
listOf(
Distributor("value", "Name"),
)
)
}
),
stringProvider = FakeStringProvider(),
)
launch {
sut.run(this)
}
sut.state.test {
assertThat(awaitItem().status).isEqualTo(NotificationTroubleshootTestState.Status.Idle(false))
assertThat(awaitItem().status).isEqualTo(NotificationTroubleshootTestState.Status.InProgress)
val lastItem = awaitItem()
assertThat(lastItem.status).isEqualTo(NotificationTroubleshootTestState.Status.Failure(true))
sut.reset()
assertThat(awaitItem().status).isEqualTo(NotificationTroubleshootTestState.Status.Idle(false))
}
}
@Test
fun `test isRelevant`() {
val sut = UnifiedPushTest(