Follow the rule renames in the view codec tests (#59)

This commit is contained in:
makiolaj committed 2026-11-26 17:23:10 +01:00
1 parent afab067884
commit 3f97683c6d
1 file changed
+6 -6
@@ -21,9 +21,9 @@ import org.junit.jupiter.api.Test
class ViewCodecTest {
private val rule = Rule.All(
private val rule = Rule.AllOf(
listOf(
Rule.Any(listOf(Rule.InList(setOf(2L), setOf("EXTERNAL:7")), Rule.HasTag("next, action|(x)"))),
Rule.AnyOf(listOf(Rule.InList(setOf(2L), setOf("EXTERNAL:7")), Rule.HasTag("next, action|(x)"))),
Rule.Not(Rule.Due(DueSpec.Window(DueWindow.NO_DATE))),
Rule.MinPriority(Priority.HIGH),
Rule.Due(DueSpec.NextDays(7)),
@@ -71,8 +71,8 @@ class ViewCodecTest {
val raw = ViewCodec.encode(views, "OWN")
val external = ViewCodec.decode(raw, "EXTERNAL")
assertThat(external[1].blocks.single { it.id == 2L }.source).isEqualTo(BlockSource.ListElsewhere("OWN:9"))
val scope = external[1].scope as Rule.All
assertThat((scope.children[0] as Rule.Any).children[0]).isEqualTo(Rule.InList(setOf(7L), setOf("OWN:2")))
val scope = external[1].scope as Rule.AllOf
assertThat((scope.children[0] as Rule.AnyOf).children[0]).isEqualTo(Rule.InList(setOf(7L), setOf("OWN:2")))
assertThat(ViewCodec.decode(ViewCodec.encode(external, "EXTERNAL"), "OWN")).isEqualTo(views)
}
@@ -88,9 +88,9 @@ class ViewCodecTest {
val raw = ViewCodec.encode(views, "OWN")
val pruned = ViewCodec.decode(ViewCodec.withoutLists(raw, "OWN") { it == 9L || it == 2L }, "OWN")[1]
assertThat(pruned.blocks.map { it.id }).doesNotContain(2L)
val scope = pruned.scope as Rule.All
val scope = pruned.scope as Rule.AllOf
// A nested list condition left without this store's lists still names the other store's.
assertThat((scope.children[0] as Rule.Any).children[0]).isEqualTo(Rule.InList(emptySet(), setOf("EXTERNAL:7")))
assertThat((scope.children[0] as Rule.AnyOf).children[0]).isEqualTo(Rule.InList(emptySet(), setOf("EXTERNAL:7")))
assertThat(ViewCodec.withoutLists(raw, "OWN") { it == 99L }).isSameInstanceAs(raw)
val withoutFilter = ViewCodec.decode(ViewCodec.withoutFilter(raw, "OWN", 12), "OWN")[1]