From e73950458f1ad5f13fa2458ed61f3ff2587b8860 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Fri, 6 Nov 2026 10:30:42 -0500 Subject: [PATCH] test(android): the slow-hydration test's row carries the mock server URL On a real background dispatcher the store's row collector lands after construction and reset the base URL to the default, so the request went to localhost:8080 instead of the mock server. The row now holds the server URL. Co-Authored-By: Claude Opus 5.5 --- .../minstrel/api/AuthCookieInterceptorTest.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/android/app/src/test/java/com/fabledsword/minstrel/api/AuthCookieInterceptorTest.kt b/android/app/src/test/java/com/fabledsword/minstrel/api/AuthCookieInterceptorTest.kt index f93a9ac0..7f1455e8 100644 --- a/android/app/src/test/java/com/fabledsword/minstrel/api/AuthCookieInterceptorTest.kt +++ b/android/app/src/test/java/com/fabledsword/minstrel/api/AuthCookieInterceptorTest.kt @@ -4,6 +4,7 @@ import com.fabledsword.minstrel.auth.AuthStore import com.fabledsword.minstrel.auth.FakeSessionVault import com.fabledsword.minstrel.auth.SessionVault import com.fabledsword.minstrel.cache.db.dao.AuthSessionDao +import com.fabledsword.minstrel.cache.db.entities.AuthSessionEntity import io.mockk.coEvery import io.mockk.every import io.mockk.mockk @@ -155,16 +156,19 @@ class AuthCookieInterceptorTest { override fun write(value: String?): Boolean = true } + // The store runs on a real background dispatcher here, so its row + // collector lands after construction; the row itself carries the + // server URL so that collector cannot reset it to the default. + val row = AuthSessionEntity(baseUrl = server.url("/").toString()) val dao = mockk { - every { observe() } returns flowOf(null) - coEvery { get() } returns null + every { observe() } returns flowOf(row) + coEvery { get() } returns row coEvery { upsert(any()) } returns Unit coEvery { setSessionCookie(any()) } returns Unit coEvery { setBaseUrl(any()) } returns Unit } val loading = AuthStore(dao, slowVault, CoroutineScope(SupervisorJob() + Dispatchers.Default)) - loading.setBaseUrl(server.url("/").toString()) val launchClient = OkHttpClient.Builder() .addInterceptor(AuthCookieInterceptor(loading))