Keep each external provider's list settings apart, forget lists through one helper (#100, #77)

This commit is contained in:
makiolaj committed 2026-11-20 12:28:37 +01:00
1 parent 2ce375bb85
commit 95cc8cd0dd
5 files changed
+103 -42

No files matched your search

@@ -1,6 +1,7 @@
package de.jeanlucmakiola.agendula.data.prefs
import com.google.common.truth.Truth.assertThat
import de.jeanlucmakiola.agendula.data.tasks.StorageMode
import org.junit.jupiter.api.Test
class GoneListsTest {
@@ -33,4 +34,20 @@ class GoneListsTest {
assertThat(withoutGoneLists(entries, ListEntry.COLLAPSED, "OWN", present))
.containsExactly("list:OWN:2", "list:EXTERNAL:5", "COMPLETED", "day:2026-11-20")
}
@Test
fun `another external provider's lists are kept apart, the first one's stay where they were`() {
assertThat(listScope(StorageMode.OWN, null, "org.dmfs.tasks")).isEqualTo("OWN")
assertThat(listScope(StorageMode.EXTERNAL, "org.dmfs.tasks", null)).isEqualTo("EXTERNAL")
assertThat(listScope(StorageMode.EXTERNAL, "org.dmfs.tasks", "org.dmfs.tasks")).isEqualTo("EXTERNAL")
val other = listScope(StorageMode.EXTERNAL, "org.tasks.opentasks", "org.dmfs.tasks")
assertThat(other).isEqualTo("EXTERNAL@org.tasks.opentasks")
val entries = setOf("EXTERNAL:3=ALWAYS", "$other:3=NEVER", "$other:4=ALWAYS")
assertThat(withoutGoneLists(entries, ListEntry.PERSISTENCE, other, setOf(3L)))
.containsExactly("EXTERNAL:3=ALWAYS", "$other:3=NEVER")
assertThat(withoutGoneLists(entries, ListEntry.PERSISTENCE, "EXTERNAL", setOf(9L)))
.containsExactly("$other:3=NEVER", "$other:4=ALWAYS")
assertThat(parseListPersistence(entries, "EXTERNAL")).containsExactly(3L, ListPersistence.ALWAYS)
}
}