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>
35 lines
1.0 KiB
Kotlin
35 lines
1.0 KiB
Kotlin
package dev.castarr.tv.data
|
|
|
|
import org.junit.Assert.assertEquals
|
|
import org.junit.Test
|
|
|
|
class XmltvWindowTest {
|
|
|
|
private fun p(startMin: Long, endMin: Long, title: String) =
|
|
Programme(startMin * 60_000, endMin * 60_000, title)
|
|
|
|
private val schedule = listOf(
|
|
p(0, 60, "Läuft gerade"),
|
|
p(60, 120, "Gleich danach"),
|
|
p(150, 210, "In zweieinhalb Stunden"),
|
|
p(300, 360, "Deutlich später"),
|
|
)
|
|
|
|
@Test
|
|
fun `returns programmes overlapping the window`() {
|
|
val titles = XmltvParser.programmesIn(schedule, 30 * 60_000, 180 * 60_000).map { it.title }
|
|
assertEquals(listOf("Läuft gerade", "Gleich danach", "In zweieinhalb Stunden"), titles)
|
|
}
|
|
|
|
@Test
|
|
fun `excludes programmes outside the window`() {
|
|
val titles = XmltvParser.programmesIn(schedule, 0, 60 * 60_000).map { it.title }
|
|
assertEquals(listOf("Läuft gerade"), titles)
|
|
}
|
|
|
|
@Test
|
|
fun `handles a missing schedule`() {
|
|
assertEquals(emptyList<Programme>(), XmltvParser.programmesIn(null, 0, 1_000))
|
|
}
|
|
}
|