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): guard Home UI state defaults

David Nashash9082bf7d7d19
diff --git a/feature/live/src/test/java/com/streamvault/feature/live/presentation/home/HomeUiStateTest.kt b/feature/live/src/test/java/com/streamvault/feature/live/presentation/home/HomeUiStateTest.kt
new file mode 100644
index 00000000..1ac74d00
--- /dev/null
+++ b/feature/live/src/test/java/com/streamvault/feature/live/presentation/home/HomeUiStateTest.kt
@@ -0,0 +1,29 @@
+package com.streamvault.feature.live.presentation.home
+
+import com.google.common.truth.Truth.assertThat
+import com.streamvault.domain.model.LiveTvChannelMode
+import org.junit.Test
+
+class HomeUiStateTest {
+ @Test
+ fun `defaults preserve live browse startup state`() {
+ val state = HomeUiState()
+
+ assertThat(state.isLoading).isTrue()
+ assertThat(state.isCategoriesLoading).isTrue()
+ assertThat(state.liveTvChannelMode).isEqualTo(LiveTvChannelMode.PRO)
+ assertThat(state.multiviewChannelCount).isEqualTo(0)
+ assertThat(state.multiviewSlotCapacity).isEqualTo(4)
+ }
+
+ @Test
+ fun `state updates remain immutable`() {
+ val initial = HomeUiState()
+ val updated = initial.copy(channelSearchQuery = "news", hasChannels = true)
+
+ assertThat(initial.channelSearchQuery).isEmpty()
+ assertThat(initial.hasChannels).isFalse()
+ assertThat(updated.channelSearchQuery).isEqualTo("news")
+ assertThat(updated.hasChannels).isTrue()
+ }
+}