test(android): the slow-hydration test's row carries the mock server URL
release / web (push) Successful in 1m34s
release / go (push) Successful in 1m58s
release / govulncheck (push) Successful in 20s
release / integration (push) Successful in 4m57s
release / android (push) Successful in 4m30s
release / Build signed APK (push) Successful in 4m56s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 16s
release / Verify release artifacts (tag releases only) (push) Skipped

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 <noreply@anthropic.com>
This commit is contained in:
2026-11-06 10:30:42 -05:00
co-authored by Claude Opus 5.5
parent 454d71d079
commit e73950458f
@@ -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<AuthSessionDao> {
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))