From e580e1ac907cb6dbccefc3016dcc7010f52f3b98 Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Wed, 4 Dec 2024 09:30:34 -0800 Subject: [PATCH] add static can message --- .../org/xmtp/android/library/ClientTest.kt | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/library/src/androidTest/java/org/xmtp/android/library/ClientTest.kt b/library/src/androidTest/java/org/xmtp/android/library/ClientTest.kt index 5bb831ff..6fcfd09e 100644 --- a/library/src/androidTest/java/org/xmtp/android/library/ClientTest.kt +++ b/library/src/androidTest/java/org/xmtp/android/library/ClientTest.kt @@ -72,6 +72,33 @@ class ClientTest { assertEquals(inboxId, client.inboxId) } + @Test + fun testStaticCanMessage() { + val context = InstrumentationRegistry.getInstrumentation().targetContext + val fixtures = fixtures() + val notOnNetwork = PrivateKeyBuilder() + + val canMessageList = runBlocking { + Client.canMessage( + listOf( + fixtures.alix.walletAddress, + notOnNetwork.address, + fixtures.bo.walletAddress + ), context, ClientOptions.Api(XMTPEnvironment.LOCAL, false) + ) + } + + val expectedResults = mapOf( + fixtures.alix.walletAddress.lowercase() to true, + notOnNetwork.address.lowercase() to false, + fixtures.bo.walletAddress.lowercase() to true + ) + + expectedResults.forEach { (address, expected) -> + assertEquals(expected, canMessageList[address.lowercase()]) + } + } + @Test fun testCanDeleteDatabase() { val key = SecureRandom().generateSeed(32)