Skip to content

Commit

Permalink
capitalize label in tests
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo <[email protected]>
  • Loading branch information
Balcan committed Feb 9, 2024
1 parent b7b87d2 commit 3d0a724
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.dhis2.usescases.flow.searchFlow

import android.content.Intent
import androidx.compose.ui.text.capitalize
import androidx.compose.ui.text.intl.Locale
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.rule.ActivityTestRule
import org.dhis2.R
Expand All @@ -27,7 +29,7 @@ class SearchFlowTest : BaseTest() {
setDatePicker()
val registerTEIDetails = createRegisterTEI()
val enrollmentStatus = context.getString(R.string.filters_title_enrollment_status)
.format(context.resources.getQuantityString(R.plurals.enrollment, 1))
.format(context.resources.getQuantityString(R.plurals.enrollment, 1).capitalize(Locale.current))
val filterCounter = "1"
val filterTotalCount = "2"
prepareWomanProgrammeIntentAndLaunchActivity(rule)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package org.dhis2.usescases.searchte
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.performClick
import androidx.compose.ui.text.capitalize
import androidx.compose.ui.text.intl.Locale
import androidx.test.espresso.IdlingRegistry
import androidx.test.espresso.IdlingResourceTimeoutException
import androidx.test.ext.junit.runners.AndroidJUnit4
Expand Down Expand Up @@ -145,7 +147,7 @@ class SearchTETest : BaseTest() {
@Test
fun shouldSuccessfullyFilterByEnrollmentStatusActive() {
val enrollmentStatusFilter = context.getString(R.string.filters_title_enrollment_status)
.format(context.resources.getQuantityString(R.plurals.enrollment, 1))
.format(context.resources.getQuantityString(R.plurals.enrollment, 1).capitalize(Locale.current))
val totalFilterCount = "2"
val filterCount = "1"

Expand Down Expand Up @@ -311,7 +313,7 @@ class SearchTETest : BaseTest() {
val lastName = "Jones"
val namePosition = 0
val enrollmentStatus = context.getString(R.string.filters_title_enrollment_status)
.format(context.resources.getQuantityString(R.plurals.enrollment, 1))
.format(context.resources.getQuantityString(R.plurals.enrollment, 1).capitalize(Locale.current))
val totalCount = "2"
val totalFilterCount = "1"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,19 @@ class D2ErrorUtils(
context.getString(R.string.error_org_unit_scope)
D2ErrorCode.INVALID_CHARACTERS ->
context.getString(R.string.error_invalid_characters)
D2ErrorCode.PROGRAM_ACCESS_CLOSED ->
TODO("Implement for ANDROAPP-657")
D2ErrorCode.PROGRAM_ACCESS_CLOSED -> defaultError()
D2ErrorCode.SERVER_CONNECTION_ERROR ->
if (networkUtils.isOnline()) {
context.getString(R.string.error_server_unavailable)
} else {
context.getString(R.string.error_no_internet_connection)
}

D2ErrorCode.DATABASE_IMPORT_FAILED -> TODO()
D2ErrorCode.DATABASE_IMPORT_INVALID_FILE -> TODO()
D2ErrorCode.DATABASE_IMPORT_FAILED -> defaultError()
D2ErrorCode.DATABASE_IMPORT_INVALID_FILE -> defaultError()
}
}

private fun defaultError() =
context.getString(R.string.error_unexpected)
}

0 comments on commit 3d0a724

Please sign in to comment.