Skip to content

Commit 05ea2de

Browse files
committed
Update comments for setting StandardTestDispatcher for single tests
1 parent ca80c98 commit 05ea2de

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

app/src/test/java/com/example/android/architecture/blueprints/todoapp/addedittask/AddEditTaskViewModelTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class AddEditTaskViewModelTest {
8484

8585
@Test
8686
fun loadTasks_loading() = runTest {
87-
// Override eagerly executing Main dispatcher for just a single test
87+
// Set Main dispatcher to not run coroutines eagerly, for just this one test
8888
Dispatchers.setMain(StandardTestDispatcher())
8989

9090
// Load the task in the viewmodel

app/src/test/java/com/example/android/architecture/blueprints/todoapp/statistics/StatisticsViewModelTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class StatisticsViewModelTest {
104104

105105
@Test
106106
fun loadTasks_loading() = runTest {
107-
// Override eagerly executing Main dispatcher for just a single test
107+
// Set Main dispatcher to not run coroutines eagerly, for just this one test
108108
Dispatchers.setMain(StandardTestDispatcher())
109109

110110
// Load the task in the viewmodel

app/src/test/java/com/example/android/architecture/blueprints/todoapp/taskdetail/TaskDetailViewModelTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ class TaskDetailViewModelTest {
162162

163163
@Test
164164
fun loadTask_loading() = runTest {
165-
// Override eagerly executing Main dispatcher for just a single test
165+
// Set Main dispatcher to not run coroutines eagerly, for just this one test
166166
Dispatchers.setMain(StandardTestDispatcher())
167167

168168
// Load the task in the viewmodel

app/src/test/java/com/example/android/architecture/blueprints/todoapp/tasks/TasksViewModelTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class TasksViewModelTest {
7272

7373
@Test
7474
fun loadAllTasksFromRepository_loadingTogglesAndDataLoaded() = runTest {
75-
// Override eagerly executing Main dispatcher for just a single test
75+
// Set Main dispatcher to not run coroutines eagerly, for just this one test
7676
Dispatchers.setMain(StandardTestDispatcher())
7777

7878
// Given an initialized TasksViewModel with initialized tasks

0 commit comments

Comments
 (0)