Test: block eligibility is worked out afresh when the pool or the block changes
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -44,4 +44,20 @@ class EventAppointmentsTest {
|
||||
assertEquals(3, starts.size)
|
||||
assertTrue("late by $starts", starts.all { it in 0..20 })
|
||||
}
|
||||
|
||||
@Test fun eligibilityIsWorkedOutAfreshWhenThePoolOrTheBlockChanges() {
|
||||
fun show(t: String) = PoolSeries(t, t, listOf(PoolEpisode("$t-1", "s", EpisodeMark(1, 1), "E1", 1_800_000)))
|
||||
val part = DayPart(0, 24, listOf("A", "B"))
|
||||
val first = listOf(show("A"), show("C"))
|
||||
assertEquals(listOf("A"), dayPartFor(first, listOf(part), monday, zone).first.map { it.title })
|
||||
// A refreshed pool is a new list, even with a show added from the catalogue: it's matched again.
|
||||
val refreshed = listOf(show("A"), show("B"), show("C"))
|
||||
assertEquals(listOf("A", "B"), dayPartFor(refreshed, listOf(part), monday, zone).first.map { it.title })
|
||||
// A changed block (a new release's rules) is a new block: it's matched again too.
|
||||
val widened = part.copy(titles = part.titles + "C")
|
||||
assertEquals(listOf("A", "B", "C"), dayPartFor(refreshed, listOf(widened), monday, zone).first.map { it.title })
|
||||
// And the first pool still gives its own answer.
|
||||
assertEquals(listOf("A"), dayPartFor(first, listOf(part), monday, zone).first.map { it.title })
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user