Add send delete confirmation dialog (#595)

This commit is contained in:
David Perez
2024-01-12 15:54:46 -06:00
committed by GitHub
parent 8fa9f337ad
commit 190bfa2a3f
2 changed files with 48 additions and 4 deletions

View File

@@ -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)
}