🚧 Filter new replies using the current Sone
[Sone.git] / src / test / kotlin / net / pterodactylus / sone / web / NewElementsTest.kt
index 2b4436d..fbd40bc 100644 (file)
@@ -23,6 +23,7 @@ import net.pterodactylus.sone.data.PostReply
 import net.pterodactylus.sone.data.Sone
 import net.pterodactylus.sone.notify.ListNotification
 import net.pterodactylus.sone.notify.PostVisibilityFilter
+import net.pterodactylus.sone.notify.ReplyVisibilityFilter
 import net.pterodactylus.sone.notify.matchThisPost
 import net.pterodactylus.sone.notify.matchThisReply
 import net.pterodactylus.sone.notify.showAllPosts
@@ -96,6 +97,15 @@ class NewElementsTest {
                assertThat(newElements.newPosts(localSone), contains(post2))
        }
 
+       @Test
+       fun `new replies are filtered using the given Sone`() {
+               val replyVisibilityFilter = object : ReplyVisibilityFilter {
+                       override fun isReplyVisible(sone: Sone?, reply: PostReply) = (sone == localSone) && (reply == reply2)
+               }
+               val newElements = NewElements(newPostNotification, newReplyNotification, localPostNotification, localReplyNotification, showAllPosts, replyVisibilityFilter)
+               assertThat(newElements.newReplies(localSone), contains(reply2))
+       }
+
 }
 
 private val post1 = createPost()