-
-
Save zsmb13/de5c5b0c6c8aa6af951602fcc8df8ebb 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
// Copyright 2022 Google LLC. | |
// SPDX-License-Identifier: Apache-2.0 | |
@Test | |
fun loadTasks_loading() = runTest { | |
// Set Main dispatcher to not run coroutines eagerly, for just this one test | |
Dispatchers.setMain(StandardTestDispatcher()) | |
// Load the task in the viewmodel | |
statisticsViewModel.refresh() | |
// Then progress indicator is shown | |
assertThat(statisticsViewModel.dataLoading.getOrAwaitValue()).isTrue() | |
// Execute pending coroutine actions | |
advanceUntilIdle() | |
// Then progress indicator is hidden | |
assertThat(statisticsViewModel.dataLoading.getOrAwaitValue()).isFalse() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment