test: lock down that updateTask no longer writes _tasksByResidence

Catches re-introduction of the conditional _tasksByResidence write
branch removed in the previous commit. The per-residence cache is
deprecated; updateTask must only mutate _allTasks.
This commit is contained in:
Trey t
2026-04-25 10:39:01 -05:00
parent 5f7498b755
commit 3df5645f73
@@ -88,6 +88,21 @@ class DataManagerTaskCacheTest {
assertEquals("v2", inProgress.tasks.first { it.id == 5 }.title) assertEquals("v2", inProgress.tasks.first { it.id == 5 }.title)
} }
/// Lockdown: updateTask must NOT touch `_tasksByResidence`. That cache
/// is being deleted in Phase 3; until then, updateTask must leave it
/// alone. If a future commit re-introduces the conditional write
/// branch this test catches it.
@Test
fun updateTask_doesNotMutate_tasksByResidence() {
val before = DataManager.tasksByResidence.value
DataManager.updateTask(sampleTask(id = 1, residenceId = 100, column = "upcoming_tasks"))
assertEquals(
before,
DataManager.tasksByResidence.value,
"updateTask must not write to _tasksByResidence — that cache is deprecated"
)
}
private fun sampleTask( private fun sampleTask(
id: Int, id: Int,
residenceId: Int, residenceId: Int,