Skip to content

Commit 1a7a31d

Browse files
committed
adds tests for it
1 parent d9b4896 commit 1a7a31d

File tree

1 file changed

+50
-0
lines changed
  • library/src/androidTest/java/org/xmtp/android/library

1 file changed

+50
-0
lines changed

library/src/androidTest/java/org/xmtp/android/library/GroupTest.kt

+50
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,31 @@ class GroupTest {
320320
}
321321
}
322322

323+
@Test
324+
fun testCanStreamAllGroupMessages() = kotlinx.coroutines.test.runTest {
325+
val group = caroClient.conversations.newGroup(listOf(alix.walletAddress))
326+
alixClient.conversations.syncGroups()
327+
alixClient.conversations.streamAllGroupMessages().test {
328+
group.send("hi")
329+
assertEquals("hi", awaitItem().encodedContent.content.toStringUtf8())
330+
group.send("hi again")
331+
assertEquals("hi again", awaitItem().encodedContent.content.toStringUtf8())
332+
}
333+
}
334+
335+
@Test
336+
fun testCanStreamAllMessages() = kotlinx.coroutines.test.runTest {
337+
val group = caroClient.conversations.newGroup(listOf(alix.walletAddress))
338+
val conversation = boClient.conversations.newConversation(alix.walletAddress)
339+
alixClient.conversations.syncGroups()
340+
alixClient.conversations.streamAllMessages().test {
341+
group.send("hi")
342+
assertEquals("hi", awaitItem().encodedContent.content.toStringUtf8())
343+
conversation.send("hi again")
344+
assertEquals("hi again", awaitItem().encodedContent.content.toStringUtf8())
345+
}
346+
}
347+
323348
@Test
324349
fun testCanStreamDecryptedGroupMessages() = kotlinx.coroutines.test.runTest {
325350
val group = boClient.conversations.newGroup(listOf(alix.walletAddress))
@@ -333,6 +358,31 @@ class GroupTest {
333358
}
334359
}
335360

361+
@Test
362+
fun testCanStreamAllDecryptedGroupMessages() = kotlinx.coroutines.test.runTest {
363+
val group = caroClient.conversations.newGroup(listOf(alix.walletAddress))
364+
alixClient.conversations.syncGroups()
365+
alixClient.conversations.streamAllGroupDecryptedMessages().test {
366+
group.send("hi")
367+
assertEquals("hi", awaitItem().encodedContent.content.toStringUtf8())
368+
group.send("hi again")
369+
assertEquals("hi again", awaitItem().encodedContent.content.toStringUtf8())
370+
}
371+
}
372+
373+
@Test
374+
fun testCanStreamAllDecryptedMessages() = kotlinx.coroutines.test.runTest {
375+
val group = caroClient.conversations.newGroup(listOf(alix.walletAddress))
376+
val conversation = boClient.conversations.newConversation(alix.walletAddress)
377+
alixClient.conversations.syncGroups()
378+
alixClient.conversations.streamAllDecryptedMessages().test {
379+
group.send("hi")
380+
assertEquals("hi", awaitItem().encodedContent.content.toStringUtf8())
381+
conversation.send("hi again")
382+
assertEquals("hi again", awaitItem().encodedContent.content.toStringUtf8())
383+
}
384+
}
385+
336386
@Test
337387
fun testCanStreamGroups() = kotlinx.coroutines.test.runTest {
338388
boClient.conversations.streamGroups().test {

0 commit comments

Comments
 (0)