You've already forked RekomenciMobile
tests fixed
# Conflicts: # app/src/test/java/com/prodhack/moscow2025/domain/usecase/GetDefaultPhoneNumberPatternUseCaseTest.kt
This commit is contained in:
+6
-4
@@ -1,8 +1,10 @@
|
||||
package com.prodhack.moscow2025.domain.usecase
|
||||
|
||||
import com.prodhack.moscow2025.data.data_providers.PhoneNumberPatternsProvider
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertNotNull
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
import org.junit.Assert.*
|
||||
import java.util.Locale
|
||||
|
||||
class GetDefaultPhoneNumberPatternUseCaseTest {
|
||||
@@ -13,7 +15,7 @@ class GetDefaultPhoneNumberPatternUseCaseTest {
|
||||
// In a real scenario, you'd mock Locale.getDefault()
|
||||
val useCase = GetDefaultPhoneNumberPatternUseCase()
|
||||
val result = useCase.execute()
|
||||
|
||||
|
||||
// If system locale is RU, should return Russian pattern
|
||||
if (Locale.getDefault().country.equals("RU", ignoreCase = true)) {
|
||||
assertNotNull(result)
|
||||
@@ -40,7 +42,7 @@ class GetDefaultPhoneNumberPatternUseCaseTest {
|
||||
it.countryCodeISO.equals(systemLocale, ignoreCase = true)
|
||||
}
|
||||
// This is acceptable - not all locales may have patterns
|
||||
assertTrue(true)
|
||||
assertTrue(hasPatternForLocale)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +64,7 @@ class GetDefaultPhoneNumberPatternUseCaseTest {
|
||||
// This is tested implicitly through the implementation
|
||||
val result = useCase.execute()
|
||||
// Should not crash regardless of locale case
|
||||
assertNotNull(useCase)
|
||||
assertNotNull(result)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-3
@@ -69,8 +69,6 @@ class PhoneTransformationTest {
|
||||
val input = AnnotatedString("12345678901234567890") // Longer than mask
|
||||
val result = transformation.filter(input)
|
||||
assertNotNull(result)
|
||||
// Should be limited to maxLength
|
||||
val maxLength = "(000) 000-0000".count { it == '0' }
|
||||
assertTrue(result.text.text.length <= "(000) 000-0000".length)
|
||||
}
|
||||
|
||||
@@ -79,7 +77,7 @@ class PhoneTransformationTest {
|
||||
val transformation1 = PhoneVisualTransformation(mask = "(000) 000-0000", maskNumber = '0')
|
||||
val transformation2 = PhoneVisualTransformation(mask = "(000) 000-0000", maskNumber = '0')
|
||||
val transformation3 = PhoneVisualTransformation(mask = "000-0000", maskNumber = '0')
|
||||
|
||||
|
||||
assertEquals(transformation1, transformation2)
|
||||
assertNotEquals(transformation1, transformation3)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user