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:
@@ -88,6 +88,21 @@ class DataManagerTaskCacheTest {
|
||||
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(
|
||||
id: Int,
|
||||
residenceId: Int,
|
||||
|
||||
Reference in New Issue
Block a user