mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-18 00:57:02 +05:30
Add test to ensure new item is not added if name is empty
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
0ccd3b353d
commit
272f0d1d99
1 changed files with 18 additions and 0 deletions
|
@ -52,4 +52,22 @@ class MainActivityTest {
|
|||
onNodeWithTag("add_button").performClick()
|
||||
onNodeWithText("Item 1").assertIsDisplayed()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun item_addition_with_empty_name_does_not_add_new_entry() {
|
||||
composeTestRule.setContent {
|
||||
val items by mutableStateOf(arrayListOf<TodoItem>())
|
||||
TodoTheme {
|
||||
TodoApp(
|
||||
items,
|
||||
items::add,
|
||||
items::remove,
|
||||
)
|
||||
}
|
||||
}
|
||||
onNodeWithText("Item 1").assertDoesNotExist()
|
||||
onNodeWithTag("fab").performClick()
|
||||
onNodeWithTag("add_button").performClick()
|
||||
onNodeWithText("Item 1").assertDoesNotExist()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue