Skip to content

Your phone, on your command. Gotcha is world's first fully on-device AI copilot for Android that turns natural language into real device actions — safely.

test(notifications): set up the fake keystore in NotificationStoreTest

Durganshu0b9a7cf509bc
diff --git a/app/src/test/java/com/gotcha/notifications/NotificationStoreTest.kt b/app/src/test/java/com/gotcha/notifications/NotificationStoreTest.kt
index 634a682..13cb2a7 100644
--- a/app/src/test/java/com/gotcha/notifications/NotificationStoreTest.kt
+++ b/app/src/test/java/com/gotcha/notifications/NotificationStoreTest.kt
@@ -1,9 +1,11 @@
package com.gotcha.notifications
import androidx.test.core.app.ApplicationProvider
+import com.gotcha.testsupport.FakeAndroidKeyStore
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
+import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
@@ -16,6 +18,11 @@ class NotificationStoreTest {
private val pruneAfterMs = 30L * 24L * 60L * 60L * 1000L
+ // The store is backed by encrypted prefs, which need a keystore. Without this
+ // the test only passed when another test happened to install it first.
+ @Before
+ fun setUp() = FakeAndroidKeyStore.setUp()
+
@Test
fun `recordDelivery writes id, count and timestamp`() {
store.recordDelivery("m1")