Skip to content

Instantly share code, notes, and snippets.

@kfaraj
Created April 27, 2022 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kfaraj/da0424b911bcff7a163a7d3d87f31769 to your computer and use it in GitHub Desktop.
Save kfaraj/da0424b911bcff7a163a7d3d87f31769 to your computer and use it in GitHub Desktop.
@Test
fun loadNote() = runTest {
val testDispatcher = UnconfinedTestDispatcher(testScheduler)
Dispatchers.setMain(testDispatcher)
try {
val viewModel = NoteViewModel()
viewModel.loadNote()
assertEquals("Lorem ipsum", viewModel.note.value)
} finally {
Dispatchers.resetMain()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment