StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.
Kotlin iptv-player
test(data): cover M3U multi-source identity edge cases (#231)
David Nashashcf631ec998cf
diff --git a/data/src/test/java/com/streamvault/data/parser/M3uSourceIdentityTest.kt b/data/src/test/java/com/streamvault/data/parser/M3uSourceIdentityTest.ktindex 78e74f5c..653f30d9 100644--- a/data/src/test/java/com/streamvault/data/parser/M3uSourceIdentityTest.kt+++ b/data/src/test/java/com/streamvault/data/parser/M3uSourceIdentityTest.kt@@ -32,6 +32,44 @@ class M3uSourceIdentityTest {.isNotEqualTo(M3uSourceIdentity.fromEntry(8L, item))}+ @Test+ fun `same tvg id with different URLs keeps multi-source entries distinct`() {+ val primary = entry(+ tvgId = "news-hd",+ name = "News HD",+ url = "https://primary.example.com/live/news.m3u8?token=first"+ )+ val backup = entry(+ tvgId = "news-hd",+ name = "News HD backup",+ url = "https://backup.example.com/live/news.m3u8?token=second"+ )++ assertThat(M3uSourceIdentity.fromEntry(7L, primary))+ .isNotEqualTo(M3uSourceIdentity.fromEntry(7L, backup))+ assertThat(M3uSourceIdentity.stableLongId(7L, primary))+ .isNotEqualTo(M3uSourceIdentity.stableLongId(7L, backup))+ }++ @Test+ fun `digit-leading acestream hashes remain part of source identity`() {+ val first = entry(+ tvgId = "ace-live",+ name = "Ace Live",+ url = "acestream://1234567890abcdef1234567890abcdef12345678"+ )+ val second = entry(+ tvgId = "ace-live",+ name = "Ace Live backup",+ url = "acestream://2234567890abcdef1234567890abcdef12345678"+ )++ assertThat(M3uSourceIdentity.fromEntry(7L, first))+ .isNotEqualTo(M3uSourceIdentity.fromEntry(7L, second))+ assertThat(M3uSourceIdentity.stableLongId(7L, first))+ .isNotEqualTo(M3uSourceIdentity.stableLongId(7L, second))+ }+private fun entry(tvgId: String?, name: String, url: String) = M3uParser.M3uEntry(name = name,groupTitle = "General",