@@ -2,6 +2,7 @@ package org.xmtp.android.library
2
2
3
3
import androidx.test.ext.junit.runners.AndroidJUnit4
4
4
import com.google.protobuf.kotlin.toByteStringUtf8
5
+ import kotlinx.coroutines.runBlocking
5
6
import org.junit.Assert.assertEquals
6
7
import org.junit.Assert.assertTrue
7
8
import org.junit.Test
@@ -60,10 +61,12 @@ class CodecTest {
60
61
val aliceClient = fixtures.aliceClient
61
62
val aliceConversation =
62
63
aliceClient.conversations.newConversation(fixtures.bob.walletAddress)
63
- aliceConversation.send(
64
- content = 3.14 ,
65
- options = SendOptions (contentType = NumberCodec ().contentType),
66
- )
64
+ runBlocking {
65
+ aliceConversation.send(
66
+ content = 3.14 ,
67
+ options = SendOptions (contentType = NumberCodec ().contentType),
68
+ )
69
+ }
67
70
val messages = aliceConversation.messages()
68
71
assertEquals(messages.size, 1 )
69
72
if (messages.size == 1 ) {
@@ -82,10 +85,12 @@ class CodecTest {
82
85
aliceClient.conversations.newConversation(fixtures.bob.walletAddress)
83
86
val textContent = TextCodec ().encode(content = " hiya" )
84
87
val source = DecodedComposite (encodedContent = textContent)
85
- aliceConversation.send(
86
- content = source,
87
- options = SendOptions (contentType = CompositeCodec ().contentType),
88
- )
88
+ runBlocking {
89
+ aliceConversation.send(
90
+ content = source,
91
+ options = SendOptions (contentType = CompositeCodec ().contentType),
92
+ )
93
+ }
89
94
val messages = aliceConversation.messages()
90
95
val decoded: DecodedComposite ? = messages[0 ].content()
91
96
assertEquals(" hiya" , decoded?.content())
@@ -107,10 +112,12 @@ class CodecTest {
107
112
DecodedComposite (parts = listOf (DecodedComposite (encodedContent = numberContent))),
108
113
),
109
114
)
110
- aliceConversation.send(
111
- content = source,
112
- options = SendOptions (contentType = CompositeCodec ().contentType),
113
- )
115
+ runBlocking {
116
+ aliceConversation.send(
117
+ content = source,
118
+ options = SendOptions (contentType = CompositeCodec ().contentType),
119
+ )
120
+ }
114
121
val messages = aliceConversation.messages()
115
122
val decoded: DecodedComposite ? = messages[0 ].content()
116
123
val part1 = decoded!! .parts[0 ]
@@ -127,10 +134,12 @@ class CodecTest {
127
134
val aliceClient = fixtures.aliceClient!!
128
135
val aliceConversation =
129
136
aliceClient.conversations.newConversation(fixtures.bob.walletAddress)
130
- aliceConversation.send(
131
- content = 3.14 ,
132
- options = SendOptions (contentType = codec.contentType),
133
- )
137
+ runBlocking {
138
+ aliceConversation.send(
139
+ content = 3.14 ,
140
+ options = SendOptions (contentType = codec.contentType),
141
+ )
142
+ }
134
143
val messages = aliceConversation.messages()
135
144
assert (messages.isNotEmpty())
136
145
0 commit comments