Test: block eligibility is worked out afresh when the pool or the block changes
pauljd/davidson-ci: Davidson CI / quality (push) Failing after 1m35s
pauljd/davidson-ci: Davidson CI / ai-review (push) Failing after 1m23s

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-11-04 11:18:09 +00:00
co-authored by Claude Opus 5.5
parent d384dcff41
commit d207f07092
@@ -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 })
}
}