Some checks failed
Build TV app / build (push) Failing after 2s
Adds an optional rail entry per club that lists every channel whose EPG mentions the club within the next three hours, with the matching kick-off instead of the usual Now/Next. Only sport and free-to-air groups are scanned (NFL excluded), so the scan stays cheap and quiet. Which clubs appear is a per-TV setting: the signed-in viewer's own club is on by default, and every club can be switched on or off under Einstellungen -> Vereinsmenüs, so a household can follow more than one. Crests are trademarks, so the icon is a plain shield in the club colours. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
47 lines
1.5 KiB
Kotlin
47 lines
1.5 KiB
Kotlin
package dev.castarr.tv.data
|
|
|
|
import org.junit.Assert.assertEquals
|
|
import org.junit.Assert.assertFalse
|
|
import org.junit.Assert.assertNull
|
|
import org.junit.Assert.assertTrue
|
|
import org.junit.Test
|
|
|
|
class TeamFiltersTest {
|
|
|
|
private val hansa = TeamFilters.byKey("hansa")!!
|
|
private val vfb = TeamFilters.byKey("vfb")!!
|
|
|
|
@Test
|
|
fun `matches the club regardless of case and surrounding text`() {
|
|
assertTrue(hansa.matches("3. Liga: FC Hansa Rostock - Dynamo Dresden"))
|
|
assertTrue(hansa.matches("HANSA ROSTOCK KOMPAKT"))
|
|
assertTrue(vfb.matches("Bundesliga: VfB Stuttgart - Bayern München"))
|
|
}
|
|
|
|
@Test
|
|
fun `does not match unrelated programmes`() {
|
|
assertFalse(hansa.matches("Tagesschau"))
|
|
assertFalse(vfb.matches("Hansa Rostock - Saarbrücken"))
|
|
}
|
|
|
|
@Test
|
|
fun `scans sport and free-to-air groups`() {
|
|
listOf("DAZN Event", "Sky Sport", "Magenta Sport", "Amazon Prime", "Free TV / HD+", "DYN Sport")
|
|
.forEach { assertTrue(it, TeamFilters.scansGroup(it)) }
|
|
}
|
|
|
|
@Test
|
|
fun `skips NFL and unrelated groups`() {
|
|
assertFalse(TeamFilters.scansGroup("DAZN Event NFL"))
|
|
assertFalse(TeamFilters.scansGroup("Kids"))
|
|
assertFalse(TeamFilters.scansGroup("Musik"))
|
|
}
|
|
|
|
@Test
|
|
fun `assigns each viewer their own club by default`() {
|
|
assertEquals("hansa", TeamFilters.defaultKeyFor("benjamin"))
|
|
assertEquals("vfb", TeamFilters.defaultKeyFor("TobiasB"))
|
|
assertNull(TeamFilters.defaultKeyFor("someone-else"))
|
|
}
|
|
}
|