Fix issue 25 and minor refactoring (#64)

This commit is contained in:
John Shea 2023-06-27 14:53:57 -04:00 committed by GitHub
parent fa202ff162
commit 94e3827d7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 10 deletions

View File

@ -80,11 +80,11 @@ dependencies {
implementation("androidx.lifecycle:lifecycle-runtime-ktx:${rootProject.extra["lifecycle_version"]}")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:${rootProject.extra["lifecycle_version"]}")
implementation("androidx.lifecycle:lifecycle-viewmodel-savedstate:${rootProject.extra["lifecycle_version"]}")
implementation("androidx.navigation:navigation-compose:2.5.3")
implementation("androidx.navigation:navigation-compose:2.6.0")
androidTestImplementation(platform("androidx.compose:compose-bom:2023.05.01"))
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
androidTestImplementation("androidx.navigation:navigation-testing:2.5.3")
androidTestImplementation("androidx.navigation:navigation-testing:2.6.0")
androidTestImplementation("androidx.test.espresso:espresso-intents:3.5.1")
androidTestImplementation("androidx.test.ext:junit:1.1.5")

View File

@ -76,25 +76,25 @@ class CupcakeOrderScreenTest {
@Test
fun selectOptionScreen_verifyContent() {
// Given list of options
val flavours = listOf("Vanilla", "Chocolate", "Hazelnut", "Cookie", "Mango")
// And sub total
val subTotal = "$100"
val flavors = listOf("Vanilla", "Chocolate", "Hazelnut", "Cookie", "Mango")
// And subtotal
val subtotal = "$100"
// When SelectOptionScreen is loaded
composeTestRule.setContent {
SelectOptionScreen(subtotal = subTotal, options = flavours)
SelectOptionScreen(subtotal = subtotal, options = flavors)
}
// Then all the options are displayed on the screen.
flavours.forEach { flavour ->
composeTestRule.onNodeWithText(flavour).assertIsDisplayed()
flavors.forEach { flavor ->
composeTestRule.onNodeWithText(flavor).assertIsDisplayed()
}
// And then the subtotal is displayed correctly.
composeTestRule.onNodeWithText(
composeTestRule.activity.getString(
R.string.subtotal_price,
subTotal
subtotal
)
).assertIsDisplayed()
@ -148,6 +148,6 @@ class CupcakeOrderScreenTest {
R.string.subtotal_price,
fakeOrderUiState.price
)
)
).assertIsDisplayed()
}
}