From 67dd9dcafc1226e95447715f0130cc786916fcb0 Mon Sep 17 00:00:00 2001 From: Taksh Date: Fri, 4 Sep 2026 22:11:50 +0530 Subject: [PATCH] Cover blocked-peer exclusion in mention candidate helpers --- .../android/ui/MentionSuggestionsTest.kt | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/app/src/test/java/com/bitchat/android/ui/MentionSuggestionsTest.kt b/app/src/test/java/com/bitchat/android/ui/MentionSuggestionsTest.kt index 607aaf1e..d89aaaea 100644 --- a/app/src/test/java/com/bitchat/android/ui/MentionSuggestionsTest.kt +++ b/app/src/test/java/com/bitchat/android/ui/MentionSuggestionsTest.kt @@ -51,4 +51,34 @@ class MentionSuggestionsTest { fun `mention popup viewport is capped at five rows`() { assertEquals(5, MaxVisibleMentionSuggestions) } + + @Test + fun `mesh mention candidates exclude self and blocked peers`() { + val nicknames = mapOf( + "aaaa" to "me", + "bbbb" to "alice", + "cccc" to "eve" + ) + val candidates = meshMentionCandidates( + peerNicknames = nicknames, + myPeerID = "aaaa", + isPeerBlocked = { it == "cccc" } + ) + assertEquals(listOf("alice"), candidates) + } + + @Test + fun `geohash mention candidates exclude blocked pubkeys`() { + data class Person(val id: String, val name: String) + val people = listOf( + Person("aaaabbbb", "carol"), + Person("bbbbcccc", "blocked") + ) + val kept = excludeBlockedGeohashPeople( + people = people, + pubkeyOf = { it.id }, + isBlocked = { it == "bbbbcccc" } + ) + assertEquals(listOf("carol"), kept.map { it.name }) + } }