All checks were successful
Build TV app / build (push) Successful in 42s
The favourite count sat at zero while the backend already had two: the rail read the favourites off the StateFlow inside the composable instead of collecting it, so it never recomposed — a regression from making favourites work for both source types. The list collects again. Real EPG titles broke the fixture shortener in both directions. "BL: VfB Stuttgart - Saison 25-26" became a fixture against a season, and "… FC Bayern München - VfB Stuttgart - 1. Halbzeit" grew a third team; a season, a matchday, a half or a year is now rejected, and a second dash ends the away side. The kick-off chip also gave way in the row: the line below already carries the time, and "Bayer Leverkusen - VfB Stuttgart" needed the width to fit at all. Merged provider EPGs list the same programme several times, minutes apart — the day plan showed The Big Bang Theory three times and two entries marked as running at once. XmltvParser.collapseDuplicates folds a repeat into the entry whose slot it falls inside. The login code expired before anyone could confirm it: Authentik hands out a minute, and the TV dropped back to step one without a word. It fetches a fresh code instead, up to eight times. Tested against the household's own Dispatcharr through api.tv.beckm4nn.net. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
105 lines
3.2 KiB
Kotlin
105 lines
3.2 KiB
Kotlin
package dev.castarr.tv.data
|
||
|
||
import org.junit.Assert.assertEquals
|
||
import org.junit.Assert.assertNull
|
||
import org.junit.Test
|
||
|
||
class FixtureTest {
|
||
|
||
@Test
|
||
fun `competition prefix and round suffix fall away`() {
|
||
assertEquals(
|
||
"Nordstadt - FC St. Pauli",
|
||
TeamFilters.fixture("Pokal: Nordstadt - FC St. Pauli, 1. Runde"),
|
||
)
|
||
}
|
||
|
||
@Test
|
||
fun `a bare pairing survives unchanged`() {
|
||
assertEquals(
|
||
"FC Bayern München - Borussia Dortmund",
|
||
TeamFilters.fixture("FC Bayern München - Borussia Dortmund"),
|
||
)
|
||
}
|
||
|
||
@Test
|
||
fun `en dash and vs count as separators`() {
|
||
assertEquals("Schalke - HSV", TeamFilters.fixture("2. Liga: Schalke – HSV"))
|
||
assertEquals("Kiel - Rostock", TeamFilters.fixture("Kiel vs. Rostock"))
|
||
}
|
||
|
||
@Test
|
||
fun `trailing channel detail is dropped`() {
|
||
assertEquals(
|
||
"Werder - Union Berlin",
|
||
TeamFilters.fixture("Bundesliga: Werder - Union Berlin | live"),
|
||
)
|
||
}
|
||
|
||
/** A magazine about the club is a hit, but has no pairing to shorten. */
|
||
@Test
|
||
fun `a title without a pairing keeps the original`() {
|
||
assertNull(TeamFilters.fixture("FC St. Pauli: Der Rückblick"))
|
||
assertNull(TeamFilters.fixture("Sportschau"))
|
||
}
|
||
|
||
@Test
|
||
fun `a dangling separator is not a pairing`() {
|
||
assertNull(TeamFilters.fixture("Pokal: - , 1. Runde"))
|
||
}
|
||
|
||
/** Hyphenated club names must not be mistaken for the separator. */
|
||
@Test
|
||
fun `hyphens inside a name do not split`() {
|
||
assertEquals(
|
||
"Rot-Weiss Essen - Preußen Münster",
|
||
TeamFilters.fixture("3. Liga: Rot-Weiss Essen - Preußen Münster"),
|
||
)
|
||
}
|
||
|
||
// --- Titel aus echten EPG-Daten (Sky, DAZN, ran) ----------------------
|
||
|
||
@Test
|
||
fun `a real Sky title yields both clubs`() {
|
||
assertEquals(
|
||
"Bayer Leverkusen - VfB Stuttgart",
|
||
TeamFilters.fixture(
|
||
"BL: Bayer Leverkusen - VfB Stuttgart, tipico Topspiel der Woche, 16. Spieltag"
|
||
),
|
||
)
|
||
}
|
||
|
||
/** The one that gave "VfB Stuttgart - Saison 25-26" as a fixture. */
|
||
@Test
|
||
fun `a season is not an opponent`() {
|
||
assertNull(TeamFilters.fixture("BL: VfB Stuttgart - Saison 25-26"))
|
||
assertNull(TeamFilters.fixture("BL: Vereinsprofil VfB Stuttgart"))
|
||
}
|
||
|
||
@Test
|
||
fun `a trailing half is dropped, not treated as a third team`() {
|
||
assertEquals(
|
||
"Bundesliga Eröffnungsspiel FC Bayern München - VfB Stuttgart",
|
||
TeamFilters.fixture(
|
||
"ran Fußball: Bundesliga Eröffnungsspiel FC Bayern München - VfB Stuttgart - 1. Halbzeit"
|
||
),
|
||
)
|
||
}
|
||
|
||
@Test
|
||
fun `youth teams keep their suffix`() {
|
||
assertEquals(
|
||
"VfB Stuttgart U19 - SC Freiburg U19",
|
||
TeamFilters.fixture("Live DFB-Pokal Junioren: VfB Stuttgart U19 - SC Freiburg U19, 2. Runde"),
|
||
)
|
||
}
|
||
|
||
@Test
|
||
fun `a live prefix falls away with the competition`() {
|
||
assertEquals(
|
||
"VfB Stuttgart - Hamburger SV",
|
||
TeamFilters.fixture("LIVE: VfB Stuttgart - Hamburger SV"),
|
||
)
|
||
}
|
||
}
|