Add missing test on reset methods.
This commit is contained in:
@@ -59,6 +59,8 @@ class FirebaseAvailabilityTestTest {
|
||||
assertThat(awaitItem().status).isEqualTo(NotificationTroubleshootTestState.Status.InProgress)
|
||||
val lastItem = awaitItem()
|
||||
assertThat(lastItem.status).isEqualTo(NotificationTroubleshootTestState.Status.Failure(false))
|
||||
sut.reset()
|
||||
assertThat(awaitItem().status).isEqualTo(NotificationTroubleshootTestState.Status.Idle(false))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -77,6 +77,31 @@ class FirebaseTokenTestTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test FirebaseTokenTest error and reset`() = runTest {
|
||||
val firebaseStore = InMemoryFirebaseStore(null)
|
||||
val sut = FirebaseTokenTest(
|
||||
firebaseStore = firebaseStore,
|
||||
firebaseTroubleshooter = FakeFirebaseTroubleshooter(
|
||||
troubleShootResult = {
|
||||
firebaseStore.storeFcmToken(FAKE_TOKEN)
|
||||
Result.success(Unit)
|
||||
}
|
||||
),
|
||||
stringProvider = FakeStringProvider(),
|
||||
)
|
||||
launch {
|
||||
sut.run(this)
|
||||
}
|
||||
sut.state.test {
|
||||
assertThat(awaitItem().status).isEqualTo(NotificationTroubleshootTestState.Status.Idle(false))
|
||||
assertThat(awaitItem().status).isEqualTo(NotificationTroubleshootTestState.Status.InProgress)
|
||||
assertThat(awaitItem().status).isEqualTo(NotificationTroubleshootTestState.Status.Failure(true))
|
||||
sut.reset()
|
||||
assertThat(awaitItem().status).isEqualTo(NotificationTroubleshootTestState.Status.Idle(false))
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test FirebaseTokenTest isRelevant`() {
|
||||
val sut = FirebaseTokenTest(
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user