Add send delete confirmation dialog (#595)

This commit is contained in:
David Perez
2024-06-20 17:08:07 +01:00
committed by Álison Fernandes
parent 0d171e91b9
commit 5288a697e5
2 changed files with 48 additions and 4 deletions
@@ -181,7 +181,7 @@ class AddSendScreenTest : BaseComposeTest() {
}
@Test
fun `on overflow remove Delete button click should send DeleteClick`() {
fun `on overflow Delete button click should Display delete confirmation dialog`() {
mutableStateFlow.value = DEFAULT_STATE.copy(
addSendType = AddSendType.EditItem(sendItemId = "sendId"),
)
@@ -194,6 +194,31 @@ class AddSendScreenTest : BaseComposeTest() {
.onNodeWithText("Delete")
.performClick()
composeTestRule
.onNodeWithText("Are you sure you want to delete this Send?")
.assert(hasAnyAncestor(isDialog()))
.assertIsDisplayed()
}
@Test
fun `on delete confirmation dialog yes click should send DeleteClick`() {
mutableStateFlow.value = DEFAULT_STATE.copy(
addSendType = AddSendType.EditItem(sendItemId = "sendId"),
)
composeTestRule
.onNodeWithContentDescription("More")
.performClick()
composeTestRule
.onNodeWithText("Delete")
.performClick()
composeTestRule
.onNodeWithText("Yes")
.assert(hasAnyAncestor(isDialog()))
.performClick()
verify(exactly = 1) {
viewModel.trySendAction(AddSendAction.DeleteClick)
}