Fix failing unit tests
All checks were successful
Build & Test / Validate (pull_request) Successful in 14s
Build & Test / Run Unit Tests (pull_request) Successful in 9m4s
Build & Test / Run UI Tests (pull_request) Successful in 17m58s
Build & Test / Validate (push) Successful in 15s
Build & Test / Run Unit Tests (push) Successful in 9m45s
Build & Test / Run UI Tests (push) Successful in 17m39s

This commit is contained in:
William Brawner 2024-08-02 16:46:03 -06:00
parent 840ebc4fd1
commit 79a5a3809a
Signed by: wbrawner
GPG key ID: 8FF12381C6C90D35

View file

@ -5,14 +5,11 @@ import androidx.lifecycle.viewmodel.CreationExtras
import com.wbrawner.simplemarkdown.utility.Preference import com.wbrawner.simplemarkdown.utility.Preference
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.StandardTestDispatcher
import kotlinx.coroutines.test.TestResult
import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.advanceTimeBy import kotlinx.coroutines.test.advanceTimeBy
import kotlinx.coroutines.test.advanceUntilIdle import kotlinx.coroutines.test.advanceUntilIdle
import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest import kotlinx.coroutines.test.runTest
import kotlinx.coroutines.test.setMain import kotlinx.coroutines.test.setMain
import org.junit.Assert.assertEquals import org.junit.Assert.assertEquals
@ -25,8 +22,6 @@ import org.junit.Test
import timber.log.Timber import timber.log.Timber
import java.io.File import java.io.File
import java.net.URI import java.net.URI
import java.util.Deque
import java.util.concurrent.ConcurrentLinkedDeque
class MarkdownViewModelTest { class MarkdownViewModelTest {
private lateinit var fileHelper: FakeFileHelper private lateinit var fileHelper: FakeFileHelper
@ -185,7 +180,7 @@ class MarkdownViewModelTest {
requireNotNull(onClick) requireNotNull(onClick)
onClick.invoke() onClick.invoke()
} }
assertEquals(viewModel.state.value, EditorState()) assertEquals(viewModel.state.value, EditorState(reloadToggle = 0.inv()))
} }
@Test @Test
@ -204,7 +199,7 @@ class MarkdownViewModelTest {
viewModel.save(uri) viewModel.save(uri)
assertNotNull(viewModel.state.value.saveCallback) assertNotNull(viewModel.state.value.saveCallback)
requireNotNull(viewModel.state.value.saveCallback).invoke() requireNotNull(viewModel.state.value.saveCallback).invoke()
assertEquals(viewModel.state.value, EditorState()) assertEquals(viewModel.state.value, EditorState(reloadToggle = 0.inv()))
} }
@Test @Test