test: Fix ViewThreadViewModel flakiness (#1099)

Some tests were assuming the uiState would transition from .Loading to
.Success, without considering there might be a .LoadingThread
intermediate step. Cater for that to prevent test flakes.
This commit is contained in:
Nik Clayton 2024-11-13 23:36:28 +01:00 committed by GitHub
parent 22309d0156
commit 8e22a4e557
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 4 deletions

View File

@ -178,7 +178,7 @@ class ViewThreadViewModelTest {
do {
item = awaitItem()
} while (item is ThreadUiState.Loading)
} while (item !is ThreadUiState.Success)
assertEquals(
ThreadUiState.Success(
@ -219,7 +219,7 @@ class ViewThreadViewModelTest {
do {
item = awaitItem()
} while (item is ThreadUiState.Loading)
} while (item !is ThreadUiState.Success)
assertEquals(
ThreadUiState.Success(
@ -252,7 +252,7 @@ class ViewThreadViewModelTest {
do {
item = awaitItem()
} while (item is ThreadUiState.Loading)
} while (item !is ThreadUiState.Error)
assertEquals(
ThreadUiState.Error::class.java,
@ -279,7 +279,7 @@ class ViewThreadViewModelTest {
do {
item = awaitItem()
} while (item is ThreadUiState.Loading)
} while (item !is ThreadUiState.Error)
assertEquals(
ThreadUiState.Error::class.java,