Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
UDF + Unit Tests - Verify Tests
@ParameterizedTest
@MethodSource("FeedLoad")
fun `Feed Load`(test: FeedLoadTest) = testDispatcher.runBlockingTest {
mockComponents(test)
FeedLoad(test.feedType, ...).also { event ->
viewModel.feedLoad(event)
assertContentList(test, event)
}
verifyTests(test)
}
private fun verifyTests(test: FeedLoadContentTest) {
// Verifies that the method has been called.
// Use 'coVerify' with coroutines, 'every
coVerify {
ContentRepository.getMainFeedList(test.isRealtime, any())
}
// Confirms methods inside test have been verified.
confirmVerified(ContentRepository)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.