Skip to content

StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.

test(live): cover home presentation semantics

David Nashash28971f89eadc
diff --git a/docs/superpowers/plans/2026-08-28-live-feature-extraction.md b/docs/superpowers/plans/2026-08-28-live-feature-extraction.md
index df28f0e0..dd47bfff 100644
--- a/docs/superpowers/plans/2026-08-28-live-feature-extraction.md
+++ b/docs/superpowers/plans/2026-08-28-live-feature-extraction.md
@@ -699,6 +699,11 @@ Cover route category initialization, source/category/channel focus, quick-filter
Run `HomeScreenBehaviorTest`; expected missing-screen failure.
+`HomePresentationBehaviorTest` now provides connected coverage for extracted
+channel identity/program/favorite/catch-up semantics, locked-row state, and
+category rendering. The full ViewModel-driven Home journey (focus, dialogs,
+PIN, preview states, and planner callbacks) remains open.
+
- [ ] **Step 6: Move Home UI and wire live-local/core components**
Move `HomeScreen.kt`, `HomeScreenDialogs.kt`, and `HomeSidebarComponents.kt`. Replace app navigation strings with typed `AppDestination`, app shell with `CoreAppScreenScaffold`/`UiDestination`, device/time helpers with Core UI, and direct MultiView composables with `LiveMultiViewPlannerContent`.
diff --git a/feature/live/src/androidTest/java/com/streamvault/feature/live/home/HomePresentationBehaviorTest.kt b/feature/live/src/androidTest/java/com/streamvault/feature/live/home/HomePresentationBehaviorTest.kt
new file mode 100644
index 00000000..600507da
--- /dev/null
+++ b/feature/live/src/androidTest/java/com/streamvault/feature/live/home/HomePresentationBehaviorTest.kt
@@ -0,0 +1,112 @@
+package com.streamvault.feature.live.home
+
+import androidx.compose.material3.Text
+import androidx.compose.ui.test.assertIsDisplayed
+import androidx.compose.ui.test.junit4.createComposeRule
+import androidx.compose.ui.test.onNodeWithContentDescription
+import androidx.compose.ui.test.onNodeWithText
+import androidx.compose.ui.unit.dp
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import com.streamvault.core.ui.theme.StreamVaultTheme
+import com.streamvault.domain.model.Category
+import com.streamvault.domain.model.Channel
+import com.streamvault.domain.model.Program
+import com.streamvault.feature.live.presentation.components.LiveCategoryRow
+import com.streamvault.feature.live.presentation.components.LiveChannelRowSurface
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+
+@RunWith(AndroidJUnit4::class)
+class HomePresentationBehaviorTest {
+
+ @get:Rule
+ val composeRule = createComposeRule()
+
+ @Test
+ fun channelRow_exposesStableProgramFavoriteAndCatchUpSemantics() {
+ val channel = Channel(
+ id = 7L,
+ name = "World Sports HD",
+ number = 7,
+ providerId = 3L,
+ streamUrl = "https://example.test/live.m3u8",
+ isFavorite = true,
+ catchUpSupported = true,
+ catchUpDays = 2,
+ catchUpSource = "https://example.test/archive/{start}/{end}",
+ currentProgram = Program(
+ channelId = "world-sports",
+ title = "Morning Sports",
+ startTime = 0L,
+ endTime = 60_000L,
+ ),
+ )
+
+ composeRule.setContent {
+ StreamVaultTheme {
+ LiveChannelRowSurface(
+ channel = channel,
+ nowMs = 30_000L,
+ rowHeight = 68.dp,
+ onClick = {},
+ )
+ }
+ }
+
+ composeRule
+ .onNodeWithContentDescription(
+ "Channel 7, World Sports HD. Now playing Morning Sports. Favorite. Catch-up available"
+ )
+ .assertExists()
+ .assertIsDisplayed()
+ }
+
+ @Test
+ fun lockedChannelRow_exposesLockStateWithoutChangingIdentity() {
+ val channel = Channel(
+ id = 8L,
+ name = "Protected News",
+ number = 8,
+ providerId = 3L,
+ streamUrl = "https://example.test/protected.m3u8",
+ )
+
+ composeRule.setContent {
+ StreamVaultTheme {
+ LiveChannelRowSurface(
+ channel = channel,
+ nowMs = 0L,
+ onClick = {},
+ isLocked = true,
+ lockedLabel = "Locked",
+ )
+ }
+ }
+
+ composeRule
+ .onNodeWithContentDescription("Channel 8, Protected News")
+ .assertExists()
+ composeRule.onNodeWithText("Locked").assertExists().assertIsDisplayed()
+ }
+
+ @Test
+ fun categoryRow_retainsCategoryContent() {
+ composeRule.setContent {
+ StreamVaultTheme {
+ LiveCategoryRow(
+ title = "News",
+ items = listOf(Category(id = 10L, name = "World")),
+ onPinToggle = {},
+ isPinned = false,
+ keySelector = Category::id,
+ ) { category ->
+ Text(category.name)
+ }
+ }
+ }
+
+ composeRule.onNodeWithText("News").assertExists()
+ composeRule.onNodeWithText("World").assertExists()
+ }
+}