From d207f0709225ce1e855aeccdb815fbba712afc05 Mon Sep 17 00:00:00 2001 From: Pauljd Date: Wed, 4 Nov 2026 11:18:09 +0000 Subject: [PATCH] Test: block eligibility is worked out afresh when the pool or the block changes Co-Authored-By: Claude Opus 5.5 (1M context) --- .../tv/orbit/classic/EventAppointmentsTest.kt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/android/app/src/test/java/tv/orbit/classic/EventAppointmentsTest.kt b/android/app/src/test/java/tv/orbit/classic/EventAppointmentsTest.kt index f6b0a72..9c6dc11 100644 --- a/android/app/src/test/java/tv/orbit/classic/EventAppointmentsTest.kt +++ b/android/app/src/test/java/tv/orbit/classic/EventAppointmentsTest.kt @@ -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 }) + } + }