Add Orbit Gold, Heroes and Evidence, with a fallback made from each pool (0.49.0 in testing)
pauljd/davidson-ci: Davidson CI / quality (push) Failing after 1m54s
pauljd/davidson-ci: Davidson CI / ai-review (push) Failing after 1m27s

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-11-02 08:58:06 +00:00
co-authored by Claude Opus 5.5
parent 3039235d13
commit 1a5b6d67f2
20 changed files with 87 additions and 16 deletions
@@ -82,4 +82,39 @@ class ChannelPresetsTest {
fun aSearchWithoutTheFindsTheFullTitle() {
assertEquals("a", bestSeriesMatch("X-Files", listOf(series("a", "The X-Files", 1993)))?.id)
}
private fun poolShow(id: String, n: Int) = PoolSeries(id, "Show $id", (1..n).map { PoolEpisode("$id-$it", "s$id-$it", EpisodeMark(1, it), "E$it", 60_000) })
private val programming = ChannelProgramming(121, "Heroes", listOf("x"))
@Test fun aChannelWithNoLoopGetsAFallbackFromItsPool() {
val loop = loopFromPool(listOf(poolShow("a", 20), poolShow("b", 2)), programming)!!
assertEquals(15, loop.lineup.size)
assertEquals(121, loop.number)
assertEquals(listOf("a-1", "b-1", "a-2", "b-2", "a-3"), loop.lineup.take(5).map { it.item.id })
}
@Test fun tooFewEpisodesGiveNoFallback() {
assertNull(loopFromPool(listOf(poolShow("a", 1)), programming))
assertNull(loopFromPool(emptyList(), programming))
}
@Test fun theNewChannelsSurviveASaveAndRestore() {
val heroes = loopFromPool(listOf(poolShow("a", 3)), programming)!!
val restored = RememberedStateCodec.decode(RememberedStateCodec.encode(state(listOf(heroes), 121)))
assertEquals(121, restored.selectedNumber)
assertEquals(listOf(121), restored.extra.map { it.number })
}
@Test fun theNewChannelsAreConfiguredAndBranded() {
listOf(111, 121, 141).forEach { number ->
assertTrue(SmartChannels.any { it.number == number && it.exactTitles && it.finishTogether })
assertNotNull(ChannelBrands.forNumber(number))
assertTrue(ChannelPresets.first { it.number == number }.smartOnly)
}
assertEquals(ChannelCategory.Comedy, ChannelBrands.forNumber(111)!!.category)
}
@Test fun smartChannelNumbersAreUnique() {
assertEquals(SmartChannels.size, SmartChannels.map { it.number }.distinct().size)
}
}