Navigation: fix test and update log.

This commit is contained in:
ganfra
2023-09-26 11:06:49 +02:00
parent 7c00780614
commit 0bbe549e74
2 changed files with 3 additions and 4 deletions

View File

@@ -167,7 +167,7 @@ class DefaultAppNavigationStateService @Inject constructor(
} }
private fun logError(logPrefix: String) { private fun logError(logPrefix: String) {
Timber.tag(loggerTag.value).w("$logPrefix must be call first, can't leave.") Timber.tag(loggerTag.value).w("$logPrefix must be call first.")
} }
private fun NavigationState.assertOwner(owner: String): Boolean { private fun NavigationState.assertOwner(owner: String): Boolean {

View File

@@ -29,7 +29,6 @@ import io.element.android.services.appnavstate.test.A_THREAD_OWNER
import io.element.android.tests.testutils.runCancellableScopeTest import io.element.android.tests.testutils.runCancellableScopeTest
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.first
import org.junit.Assert.assertThrows
import org.junit.Test import org.junit.Test
class DefaultNavigationStateServiceTest { class DefaultNavigationStateServiceTest {
@@ -63,8 +62,8 @@ class DefaultNavigationStateServiceTest {
@Test @Test
fun testFailure() = runCancellableScopeTest { scope -> fun testFailure() = runCancellableScopeTest { scope ->
val service = createStateService(scope) val service = createStateService(scope)
service.onNavigateToSpace(A_SPACE_OWNER, A_SPACE_ID)
assertThrows(IllegalStateException::class.java) { service.onNavigateToSpace(A_SPACE_OWNER, A_SPACE_ID) } assertThat(service.appNavigationState.value.navigationState).isEqualTo(NavigationState.Root)
} }
private fun createStateService( private fun createStateService(