Add logging throughout the Android app and unit tests

Log.d/i/w/e calls covering location resolution, TTS lifecycle and
errors, nearby/search network calls and their failure paths, and
screen-level state transitions. OkHttp's logging interceptor now
routes through Log (tag "OkHttp") instead of println for consistent
filtering. Enabled testOptions.unitTests.isReturnDefaultValues so
android.util.Log calls don't crash plain JVM unit tests.

Added mockk + kotlinx-coroutines-test and a GuideViewModelTest suite
covering the load-success, load-failure, and retry paths — including
a regression test for the infinite-spinner bug (isLoading must clear
and errorMessage must be set on a failed nearby-search call, not left
hanging). Verified: ./gradlew testDebugUnitTest passes (4/4).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
vrubelroman 2026-07-09 20:10:31 +00:00
parent be67902b45
commit 6e90956b3e
17 changed files with 323 additions and 18 deletions

View file

@ -67,6 +67,14 @@ android {
compose = true
buildConfig = true
}
testOptions {
unitTests {
// Production code calls android.util.Log for observability; without this,
// the Android stub jar throws on every such call in plain JVM unit tests.
isReturnDefaultValues = true
}
}
}
dependencies {
@ -107,6 +115,8 @@ dependencies {
// isolated integration point in the meantime.
testImplementation(libs.junit)
testImplementation(libs.mockk)
testImplementation(libs.kotlinx.coroutines.test)
androidTestImplementation(libs.androidx.test.ext.junit)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(platform(libs.androidx.compose.bom))