fooddelivery: shared test scaffolding sweep
- Commit
934032b4f2ed7e7369c012b8b6ab7f8e21bf05aa- Author
- Vayun Mathur <[email protected]>
- When
- 2026-12-01 22:48 UTC (4 days ago)
- Parents
493b7b8
Replace the local FakeTokenSealer implementation with a thin adapter delegating to the shared FakeTokenSealing logic in build-logic/shared-test. Remove class-level @Config(sdk = [34]) annotations that only duplicate the repo-wide sdk=34 default in build-logic/shared-test-resources/robolectric.properties, dropping the Config import where it becomes unused. Qualifier/shadow/application and non-34 configs are untouched; files dirty from other agents' in-flight work were skipped file-by-file. Verified: :fooddelivery:testDevUnitTest green (BUILD SUCCESSFUL). Lint (:lint / :lintVitalRelease) was not run for this module in this sweep.
Diff
fooddelivery/src/test/java/com/vayunmathur/fooddelivery/data/CheckoutDraftStoreTest.kt
diff --git a/fooddelivery/src/test/java/com/vayunmathur/fooddelivery/data/CheckoutDraftStoreTest.kt b/fooddelivery/src/test/java/com/vayunmathur/fooddelivery/data/CheckoutDraftStoreTest.ktindex 072dc946c6..9fa1a589e5 100644--- a/fooddelivery/src/test/java/com/vayunmathur/fooddelivery/data/CheckoutDraftStoreTest.kt+++ b/fooddelivery/src/test/java/com/vayunmathur/fooddelivery/data/CheckoutDraftStoreTest.kt@@ -5,7 +5,6 @@ import androidx.test.core.app.ApplicationProvider import kotlinx.coroutines.runBlocking import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner-import org.robolectric.annotation.Config import kotlin.test.BeforeTest import kotlin.test.Test import kotlin.test.assertEquals@@ -13,7 +12,6 @@ import kotlin.test.assertNull /** Persist-then-death for an in-flight checkout: a fresh read restores the draft a dead process wrote. */ @RunWith(RobolectricTestRunner::class)-@Config(sdk = [34]) class CheckoutDraftStoreTest { private val context = ApplicationProvider.getApplicationContext<Context>()
fooddelivery/src/test/java/com/vayunmathur/fooddelivery/data/FoodStoresTest.kt
diff --git a/fooddelivery/src/test/java/com/vayunmathur/fooddelivery/data/FoodStoresTest.kt b/fooddelivery/src/test/java/com/vayunmathur/fooddelivery/data/FoodStoresTest.ktindex fa905f9f3c..ca307f07db 100644--- a/fooddelivery/src/test/java/com/vayunmathur/fooddelivery/data/FoodStoresTest.kt+++ b/fooddelivery/src/test/java/com/vayunmathur/fooddelivery/data/FoodStoresTest.kt@@ -9,11 +9,9 @@ import kotlin.test.assertNull import kotlin.test.assertTrue import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner-import org.robolectric.annotation.Config /** SharedPreferences-backed cart and address stores. */ @RunWith(RobolectricTestRunner::class)-@Config(sdk = [34]) class FoodStoresTest { private val context = ApplicationProvider.getApplicationContext<Context>()
fooddelivery/src/test/java/com/vayunmathur/fooddelivery/platform/FakeTokenSealer.kt
diff --git a/fooddelivery/src/test/java/com/vayunmathur/fooddelivery/platform/FakeTokenSealer.kt b/fooddelivery/src/test/java/com/vayunmathur/fooddelivery/platform/FakeTokenSealer.ktindex 4fd8635fa5..31ac50d242 100644--- a/fooddelivery/src/test/java/com/vayunmathur/fooddelivery/platform/FakeTokenSealer.kt+++ b/fooddelivery/src/test/java/com/vayunmathur/fooddelivery/platform/FakeTokenSealer.kt@@ -1,23 +1,12 @@ package com.vayunmathur.fooddelivery.platform -/**- * Host-test [TokenSealer]: Robolectric has no AndroidKeyStore, so tests seal with a- * reversible marker transform instead of AES-GCM. Mirrors the real sealer's contract —- * sealed values carry the `v1:` prefix, legacy values pass through, foreign sealed- * values fail (null) rather than passing through.- */-class FakeTokenSealer : TokenSealer {- override fun seal(plain: String): String = SEALED_PREFIX + plain+import com.vayunmathur.testsupport.FakeTokenSealing - override fun unseal(stored: String): String? = when {- stored.startsWith(SEALED_PREFIX) -> stored.removePrefix(SEALED_PREFIX)- isSealed(stored) -> null- else -> stored- }+/** Host-test [TokenSealer] delegating to the shared [FakeTokenSealing] logic. */+class FakeTokenSealer : TokenSealer {+ override fun seal(plain: String): String = FakeTokenSealing.seal(plain) - override fun isSealed(stored: String): Boolean = stored.startsWith(KeystoreTokenSealer.PREFIX)+ override fun unseal(stored: String): String? = FakeTokenSealing.unseal(stored) - private companion object {- private const val SEALED_PREFIX = "v1:fake:"- }+ override fun isSealed(stored: String): Boolean = FakeTokenSealing.isSealed(stored) }