Last active
February 9, 2019 09:34
-
-
Save CesarValiente/8abbc07438ba0ad96f25fc5bb0b4fac3 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 should_delete_Item_and_handle_State() { | |
val item1 = createItem(1) | |
val item2 = createItem(2) | |
val item3 = createItem(3) | |
val defaultList = listOf(item1, item2, item3) | |
val state = State(itemsListScreen = ItemsListScreen(defaultList), | |
navigation = Navigation.ITEMS_LIST) | |
store.dispatch(state) | |
itemsControllerViewSpy.deleteItem(item1) | |
argumentCaptor<State>().apply { | |
verify(itemsControllerViewSpy, times(2)).handleState(capture()) | |
with(lastValue.itemsListScreen) { | |
assertThat(items.size, iz(not(defaultList.size))) | |
assertThat(items.size, iz(2)) | |
assertThat(items, hasItem(not(item1))) | |
assertThat(items.component1(), iz(item2)) | |
assertThat(items.component2(), iz(item3)) | |
} | |
assertThat(lastValue.navigation, iz(Navigation.ITEMS_LIST)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment