Created
January 9, 2021 09:46
-
-
Save LordRaydenMK/95080948abeca0f0a51cd16f88889834 to your computer and use it in GitHub Desktop.
Tests part 2
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 `execute - first call succeeds, one failed call to #2 - one full item, one item with default value`() { | |
val items = listOf("Item 1" to "https://item1.jpg", "Item 2" to "invalid url") | |
val service = successService(items) | |
val viewModel = ViewModel(service) | |
val expected = listOf( | |
ViewEntity("Item 1", "https://item1.jpg".toHttpUrl()), | |
ViewEntity("Item 2", null) | |
) | |
viewModel.state | |
.test() | |
.also { viewModel.execute() } | |
.awaitCount(4) // (0) Loading, (1) Content, (2) Content (3) Content | |
.assertValueAt(3, Content(expected)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment