Created
June 21, 2023 09:30
-
-
Save kaszabimre/15831c21b04927537b61009f5b01a2d9 to your computer and use it in GitHub Desktop.
Unit test for the GitHubUserListViewModel class showcasing the simplicity of using MockKMP framework. The test sets up mock objects for GitHubUserAction and GitHubUserStore, both of which are interfaces. The GitHubUserListViewModel is instantiated using the mock dependencies, demonstrating the ease of integration with MockKMP.
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
class GitHubUserListViewModelTest : TestsWithMocks() { | |
@Mock | |
lateinit var action: GitHubUserAction | |
@Mock | |
lateinit var store: GitHubUserStore | |
private val viewModel by withMocks { GitHubUserListViewModel(action, store) } | |
override fun setUpMocks() = injectMocks(mocker) | |
.... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment