Fix tests

pull/1826/head
Alex Baker 2 years ago
parent 64a5ea2c69
commit 1de4b220c3

@ -10,6 +10,7 @@ import com.todoroo.astrid.service.TaskDeleter
import com.todoroo.astrid.service.TaskMover
import com.todoroo.astrid.timers.TimerPlugin
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.runBlocking
import org.junit.Before
import org.tasks.calendars.CalendarEventProvider
@ -63,7 +64,10 @@ open class BaseTaskEditViewModelTest : InjectingTestCase() {
db.googleTaskDao,
db.caldavDao,
taskCompleter,
alarmService)
alarmService,
MutableSharedFlow(),
MutableSharedFlow(),
)
}
protected fun setup(task: Task) = runBlocking {

@ -319,13 +319,13 @@ class TaskEditViewModel @Inject constructor(
originalAlarms.toHashSet() != selectedAlarms.value.toHashSet()
@MainThread
suspend fun save() = withContext(NonCancellable) {
suspend fun save(): Boolean = withContext(NonCancellable) {
if (cleared) {
return@withContext
return@withContext false
}
if (!hasChanges()) {
discard()
return@withContext
return@withContext false
}
clear()
task.title = if (title.isNullOrBlank()) context.getString(R.string.no_title) else title
@ -435,6 +435,7 @@ class TaskEditViewModel @Inject constructor(
}
mainActivityEvents.emit(MainActivityEvent.RequestRating)
}
true
}
private suspend fun applyCalendarChanges() {

Loading…
Cancel
Save