Add Orbit Gold, Heroes and Evidence, with a fallback made from each pool (0.49.0 in testing)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user