Ask the principal for its home sets before deleting a list, compare collection URLs by meaning (#180)

This commit is contained in:
makiolaj committed 2026-11-25 15:20:26 +01:00
1 parent 1c59c5e409
commit 91c6593ceb
9 files changed
+109 -9

No files matched your search

@@ -0,0 +1,23 @@
package de.jeanlucmakiola.agendula.data
import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.Test
class CollectionHrefTest {
@Test
fun `spelling differences name the same collection`() {
val home = "https://dav.example.com/calendars/user%40example.com/1/"
assertThat(CollectionHref.same(home, "https://dav.example.com/calendars/user@example.com/1")).isTrue()
assertThat(CollectionHref.same(home, "https://DAV.example.com:443/calendars/user%40example.com/1/")).isTrue()
}
@Test
fun `a different path, port or a missing side is not the same`() {
val home = "https://dav.example.com/calendars/user/1/"
assertThat(CollectionHref.same(home, "https://dav.example.com/calendars/user/1/tasks/")).isFalse()
assertThat(CollectionHref.same(home, "https://dav.example.com:8443/calendars/user/1/")).isFalse()
assertThat(CollectionHref.same(home, null)).isFalse()
assertThat(CollectionHref.same(null, null)).isFalse()
}
}