Created
April 27, 2022 19:51
-
-
Save kfaraj/da0424b911bcff7a163a7d3d87f31769 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
@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