fix(test): resolve the playback-error description outside composition

be7be5b6 dropped the Context argument from the description lookup in
PlaybackErrorOverlayFitTest, which turned it into a call to the
@Composable stringRes overload from a plain test function, so the
androidTest source set stopped compiling. Load it with loadStringRes in
runBlocking, like the test's other lookups, and drop the now-unused
targetContext.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BkG4KTqmnprUK9BAcwAyc8
This commit is contained in:
Claude
2026-09-27 14:00:14 +00:00
parent 9512fd886f
commit 90e346a0e5
@@ -39,13 +39,11 @@ import androidx.compose.ui.unit.dp
import androidx.media3.common.PlaybackException
import androidx.media3.common.Player
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import com.vitorpamplona.amethyst.commons.resources.Res
import com.vitorpamplona.amethyst.commons.resources.error_video_open_in_browser
import com.vitorpamplona.amethyst.commons.resources.error_video_playback_failed
import com.vitorpamplona.amethyst.commons.resources.error_video_playback_failed_description
import com.vitorpamplona.amethyst.commons.ui.loadStringRes
import com.vitorpamplona.amethyst.commons.ui.stringRes
import io.mockk.mockk
import kotlinx.coroutines.runBlocking
import org.junit.Assert.assertTrue
@@ -70,8 +68,6 @@ class PlaybackErrorOverlayFitTest {
@get:Rule
val rule = createComposeRule()
private val targetContext = InstrumentationRegistry.getInstrumentation().targetContext
/**
* Built outside composition on purpose: the mock and its error state are fixtures for the whole
* test, not per-composition state. Creating them inside `setContent` would rebuild both on every
@@ -141,10 +137,12 @@ class PlaybackErrorOverlayFitTest {
assertButtonUsable()
rule
.onNodeWithText(
stringRes(
Res.string.error_video_playback_failed_description,
"ERROR_CODE_PARSING_MANIFEST_MALFORMED",
),
runBlocking {
loadStringRes(
Res.string.error_video_playback_failed_description,
"ERROR_CODE_PARSING_MANIFEST_MALFORMED",
)
},
).assertDoesNotExist()
}