Created
July 10, 2022 09:56
-
-
Save hongbeomi/996f2d8efef5d466e832b6c6bb47040d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
fun fetchData_loading() { | |
// 메인 디스패처를 게으르게 시작하는 디스패처로 교체 | |
Dispatchers.setMain(StandardTestDispatcher()) | |
// 데이터 가져오기 | |
viewModel.fetch() | |
// 로딩 상태 체크 | |
assertEquals(true, viewModel.loading.getOrAwaitValue()) | |
// 예약되어 있던 작업 실행 | |
advanceUntilIdle() | |
// 로딩 상태 체크 | |
assertEquals(false, viewModel.loading.getOrAwaitValue()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment