0.99.0: Ring X weeknight flagships are appointments, so they start near 18:00
pauljd/davidson-ci: Davidson CI / quality (push) Failing after 1m45s
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-04 01:00:29 +00:00
co-authored by Claude Opus 5.5
parent 837f97a3bf
commit e0d600bc3d
7 changed files with 159 additions and 7 deletions
@@ -0,0 +1,36 @@
package tv.orbit.classic
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test
import java.time.DayOfWeek
class RingXWeeknightsTest {
private val zone = java.time.ZoneId.of("Europe/London")
private val day = 24 * 60 * 60_000L
private val ring get() = SmartChannels.first { it.number == 401 }
@Test fun theSixWeeknightsAreAppointmentsAndNothingElseChanged() {
val nights = ring.dayParts.filter { it.fromHour == 18 && it.toHour == 23 }
assertEquals(DayOfWeek.entries.filter { it != DayOfWeek.SUNDAY }.toSet(), nights.flatMap { it.days }.toSet())
assertTrue(nights.all { it.onTime && !it.once && it.key.startsWith("ringx.") })
val ppv = ring.dayParts.single { it.key == "ringx.ppv" }
assertTrue(ppv.onTime && ppv.once && ppv.fromHour == 19)
assertTrue(ring.dayParts.filter { it.days.isEmpty() }.none { it.onTime })
}
@Test fun theNightStartsNearItsHourWithNothingCut() {
// Vault episodes of awkward lengths, so the daytime never lands on 18:00 by itself.
fun show(title: String, minutes: Int) = PoolSeries(title, title, (1..300).map { PoolEpisode("$title-$it", "src", EpisodeMark(1, it), "E$it", minutes * 60_000L) })
val titles = ring.dayParts.flatMap { it.titles }.distinct()
val pool = titles.filter { it in listOf("WWF Prime Time Wrestling", "WWE Heat", "WCW Saturday Night", "WWE Raw", "WCW Monday Nitro", "IMPACT! Wrestling", "All Elite Wrestling: Dynamite",
"WWE SmackDown", "ECW Hardcore TV", "NJPW Strong", "Dark Side of the Ring", "WWE Untold") }.mapIndexed { i, t -> show(t, listOf(47, 89, 63, 41, 118, 52)[i % 6]) }
val start = java.time.LocalDate.of(2026, 11, 16).atStartOfDay(zone).toInstant().toEpochMilli()
val plan = extendSchedule(pool, ScheduleCursor(), start, start + 14 * day, finishTogether = true, dayParts = ring.dayParts, zone = zone)
plan.entries.zipWithNext().forEach { (a, b) -> assertEquals(a.endMs, b.startMs) }
val firsts = plan.entries.filter { "event 18-23" in it.why }.groupBy { java.time.Instant.ofEpochMilli(it.startMs).atZone(zone).toLocalDate() }
.map { (date, es) -> (es.minOf { it.startMs } - date.atTime(18, 0).atZone(zone).toInstant().toEpochMilli()) / 60_000 }
assertEquals(12, firsts.size)
assertTrue("late by $firsts", firsts.all { it in 0..20 })
}
}