Skip to content

Instantly share code, notes, and snippets.

@CesarValiente
Last active February 9, 2019 09:34
Show Gist options
  • Save CesarValiente/8abbc07438ba0ad96f25fc5bb0b4fac3 to your computer and use it in GitHub Desktop.
Save CesarValiente/8abbc07438ba0ad96f25fc5bb0b4fac3 to your computer and use it in GitHub Desktop.
@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