Description
Set up the test strategy for the Stats Collection module.
Test files to create
app/src/test/java/com/vrhub/data/StatsCollectorTest.kt
app/src/test/java/com/vrhub/data/ConsentPreferencesTest.kt
app/src/androidTest/java/com/vrhub/.../StatsCollectionIntegrationTest.kt
Unit test scenarios (StatsCollector)
Unit test scenarios (ConsentPreferences)
Integration test scenarios
Required mocks
FakeStatsApiService implementing StatsApiService
FakeConsentPreferences or in-memory DataStore usage
Reference
docs/CLIENT_IMPLEMENTATION.md §10
Description
Set up the test strategy for the Stats Collection module.
Test files to create
app/src/test/java/com/vrhub/data/StatsCollectorTest.ktapp/src/test/java/com/vrhub/data/ConsentPreferencesTest.ktapp/src/androidTest/java/com/vrhub/.../StatsCollectionIntegrationTest.ktUnit test scenarios (StatsCollector)
collectStatsdoes nothing when consent is false (no network call)collectStatssends correct payload when consent is truecollectStatsincludes correctpackage_nameandis_favoritecollectStatsincludes correcttierandtimestampupdateConsentcalls API with correct valuegetUserTierreturns tier or null on errorUnit test scenarios (ConsentPreferences)
consentEnabledemitsfalseby defaultsetConsentEnabled(true)persists and emitstruesetConsentEnabled(false)persists and emitsfalseIntegration test scenarios
maybeCollectStats()Required mocks
FakeStatsApiServiceimplementingStatsApiServiceFakeConsentPreferencesor in-memory DataStore usageReference
docs/CLIENT_IMPLEMENTATION.md§10