Skip to content

Commit

Permalink
Updated test for when categories aren't available
Browse files Browse the repository at this point in the history
  • Loading branch information
p42rthicle committed Oct 6, 2023
1 parent 7c1376b commit 810a218
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import com.hieuwu.groceriesstore.data.repository.CategoryRepository
import com.hieuwu.groceriesstore.domain.models.CategoryModel
import com.hieuwu.groceriesstore.domain.usecases.GetCategoriesListUseCase
import junit.framework.TestCase.assertEquals
import junit.framework.TestCase.assertNull
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.runBlocking
import org.junit.Before
Expand Down Expand Up @@ -57,12 +56,12 @@ class GetCategoriesListUseCaseImplTest {
@Test
fun givenCategoriesUnavailable_whenExecute_thenReturnCorrectValue() {
whenever(mockedCategoryRepository.getFromLocal()).thenReturn(flow {
null
emit(listOf())
})
runBlocking {
val result = testee.execute(GetCategoriesListUseCase.Input())
result.result.collect {
assertNull(it)
assertEquals(it.isEmpty(), true)
}
}
}
Expand Down

0 comments on commit 810a218

Please sign in to comment.