@@ -2,6 +2,7 @@ package org.xmtp.android.library
2
2
3
3
import androidx.test.ext.junit.runners.AndroidJUnit4
4
4
import androidx.test.platform.app.InstrumentationRegistry
5
+ import kotlinx.coroutines.runBlocking
5
6
import org.junit.Assert.assertEquals
6
7
import org.junit.Assert.fail
7
8
import org.junit.Ignore
@@ -124,6 +125,49 @@ class ClientTest {
124
125
assert (client.canMessageV3(listOf (client.address)))
125
126
}
126
127
128
+ @Test
129
+ fun testCanDeleteDatabase () {
130
+ val context = InstrumentationRegistry .getInstrumentation().targetContext
131
+ val fakeWallet = PrivateKeyBuilder ()
132
+ val fakeWallet2 = PrivateKeyBuilder ()
133
+ var client =
134
+ Client ().create(
135
+ account = fakeWallet,
136
+ options = ClientOptions (
137
+ ClientOptions .Api (XMTPEnvironment .LOCAL , false ),
138
+ enableAlphaMls = true ,
139
+ appContext = context
140
+ )
141
+ )
142
+ val client2 =
143
+ Client ().create(
144
+ account = fakeWallet2,
145
+ options = ClientOptions (
146
+ ClientOptions .Api (XMTPEnvironment .LOCAL , false ),
147
+ enableAlphaMls = true ,
148
+ appContext = context
149
+ )
150
+ )
151
+ client.conversations.newGroup(listOf (client2.address,))
152
+ runBlocking { client.conversations.syncGroups() }
153
+ assertEquals(client.conversations.listGroups().size, 1 )
154
+
155
+ client.deleteLocalDatabase()
156
+
157
+ client =
158
+ Client ().create(
159
+ account = fakeWallet,
160
+ options = ClientOptions (
161
+ ClientOptions .Api (XMTPEnvironment .LOCAL , false ),
162
+ enableAlphaMls = true ,
163
+ appContext = context
164
+ )
165
+ )
166
+
167
+ runBlocking { client.conversations.syncGroups() }
168
+ assertEquals(client.conversations.listGroups().size, 0 )
169
+ }
170
+
127
171
@Test
128
172
fun testCreatesAV3DevClient () {
129
173
val context = InstrumentationRegistry .getInstrumentation().targetContext
0 commit comments