diff --git a/library/src/androidTest/java/org/xmtp/android/library/GroupTest.kt b/library/src/androidTest/java/org/xmtp/android/library/GroupTest.kt index bec071937..56bb764ac 100644 --- a/library/src/androidTest/java/org/xmtp/android/library/GroupTest.kt +++ b/library/src/androidTest/java/org/xmtp/android/library/GroupTest.kt @@ -47,36 +47,36 @@ class GroupTest { @Test fun testCanCreateAGroup() { - val group = boClient.conversations.newGroup(listOf(alix.walletAddress)) + val group = boClient.conversations.newGroup(listOf(alix.walletAddress.lowercase())) assert(group.id.isNotEmpty()) } @Test fun testCanListGroupMembers() { - val group = boClient.conversations.newGroup(listOf(alix.walletAddress)) - group.addMembers(listOf(caro.walletAddress)) - assertSame( - group.memberAddresses(), + val group = boClient.conversations.newGroup(listOf(alix.walletAddress.lowercase())) + group.addMembers(listOf(caro.walletAddress.lowercase())) + assertEquals( + group.memberAddresses().sorted(), listOf( caro.walletAddress.lowercase(), alix.walletAddress.lowercase(), bo.walletAddress.lowercase() - ) + ).sorted() ) } @Test fun testCanListGroups() { - boClient.conversations.newGroup(listOf(alix.walletAddress)) - boClient.conversations.newGroup(listOf(caro.walletAddress)) + boClient.conversations.newGroup(listOf(alix.walletAddress.lowercase())) + boClient.conversations.newGroup(listOf(caro.walletAddress.lowercase())) val groups = boClient.conversations.listGroups() assertEquals(groups.size, 2) } @Test fun testCanListGroupsAndConversations() { - boClient.conversations.newGroup(listOf(alix.walletAddress)) - boClient.conversations.newGroup(listOf(caro.walletAddress)) + boClient.conversations.newGroup(listOf(alix.walletAddress.lowercase())) + boClient.conversations.newGroup(listOf(caro.walletAddress.lowercase())) boClient.conversations.newConversation(alix.walletAddress) val convos = boClient.conversations.list(includeGroups = true) assertEquals(convos.size, 3) @@ -84,10 +84,11 @@ class GroupTest { @Test fun testCanSendMessageToGroup() { - val group = boClient.conversations.newGroup(listOf(alix.walletAddress)) + val group = boClient.conversations.newGroup(listOf(alix.walletAddress.lowercase())) group.send("howdy") group.send("gm") runBlocking { group.sync() } + assertEquals(group.messages().last().body, "gm") assertEquals(group.messages().size, 2) } } \ No newline at end of file diff --git a/library/src/main/java/org/xmtp/android/library/Conversations.kt b/library/src/main/java/org/xmtp/android/library/Conversations.kt index 1ff6c6791..418787224 100644 --- a/library/src/main/java/org/xmtp/android/library/Conversations.kt +++ b/library/src/main/java/org/xmtp/android/library/Conversations.kt @@ -92,6 +92,10 @@ data class Conversations( return Group(client, group) } + suspend fun syncGroups() { + libXMTPConversations?.sync() + } + fun listGroups(): List { return runBlocking { libXMTPConversations?.list(opts = FfiListConversationsOptions(null, null, null))?.map {