diff --git a/library/src/androidTest/java/org/xmtp/android/library/ConversationTest.kt b/library/src/androidTest/java/org/xmtp/android/library/ConversationTest.kt index c6aacc425..8229b2045 100644 --- a/library/src/androidTest/java/org/xmtp/android/library/ConversationTest.kt +++ b/library/src/androidTest/java/org/xmtp/android/library/ConversationTest.kt @@ -493,9 +493,9 @@ class ConversationTest { (topic.equals(steveConversation.topic) || topic.equals(bobConversation.topic)) } assertEquals(3, messages.size) - assertTrue(isSteveOrBobConversation(messages[0].topic)) - assertTrue(isSteveOrBobConversation(messages[1].topic)) - assertTrue(isSteveOrBobConversation(messages[2].topic)) + assertTrue("isSteveOrBobConversation message 0", isSteveOrBobConversation(messages[0].topic)) + assertTrue("isSteveOrBobConversation message 1", isSteveOrBobConversation(messages[1].topic)) + assertTrue("isSteveOrBobConversation message 2", isSteveOrBobConversation(messages[2].topic)) } @Test @@ -790,8 +790,8 @@ class ConversationTest { val isAllowed = bobConversation.consentState() == ConsentState.ALLOWED // Conversations you start should start as allowed - assertTrue(isAllowed) - assertTrue(bobClient.contacts.isAllowed(alice.walletAddress)) + assertTrue("Bob convo should be allowed", isAllowed) + assertTrue("Bob contacts should be allowed", bobClient.contacts.isAllowed(alice.walletAddress)) runBlocking { bobClient.contacts.deny(listOf(alice.walletAddress)) @@ -799,18 +799,18 @@ class ConversationTest { } val isDenied = bobConversation.consentState() == ConsentState.DENIED assertEquals(bobClient.contacts.consentList.entries.size, 1) - assertTrue(isDenied) + assertTrue("Bob Conversation should be denied", isDenied) val aliceConversation = runBlocking { aliceClient.conversations.list()[0] } val isUnknown = aliceConversation.consentState() == ConsentState.UNKNOWN // Conversations started with you should start as unknown - assertTrue(isUnknown) + assertTrue("Alice conversation should be unknown", isUnknown) runBlocking { aliceClient.contacts.allow(listOf(bob.walletAddress)) } val isBobAllowed = aliceConversation.consentState() == ConsentState.ALLOWED - assertTrue(isBobAllowed) + assertTrue("Bob should be allowed from alice conversation", isBobAllowed) val aliceClient2 = Client().create(aliceWallet) val aliceConversation2 = runBlocking { aliceClient2.conversations.list()[0] } @@ -820,7 +820,7 @@ class ConversationTest { // Allow state should sync across clients val isBobAllowed2 = aliceConversation2.consentState() == ConsentState.ALLOWED - assertTrue(isBobAllowed2) + assertTrue("Bob should be allowed from conversation 2", isBobAllowed2) } @Test @@ -830,13 +830,13 @@ class ConversationTest { val isAllowed = bobConversation.consentState() == ConsentState.ALLOWED // Conversations you start should start as allowed - assertTrue(isAllowed) + assertTrue("Bob convo should be allowed", isAllowed) val aliceConversation = runBlocking { aliceClient.conversations.list()[0] } val isUnknown = aliceConversation.consentState() == ConsentState.UNKNOWN // Conversations you receive should start as unknown - assertTrue(isUnknown) + assertTrue("Alice convo should be unknown", isUnknown) runBlocking { aliceConversation.send(content = "hey bob") @@ -845,7 +845,7 @@ class ConversationTest { val isNowAllowed = aliceConversation.consentState() == ConsentState.ALLOWED // Conversations you send a message to get marked as allowed - assertTrue(isNowAllowed) + assertTrue("Should now be allowed", isNowAllowed) } @Test @@ -857,12 +857,12 @@ class ConversationTest { bobClient.contacts.refreshConsentList() Thread.sleep(1000) assertEquals(bobClient.contacts.consentList.entries.size, 2) - assertTrue(bobConversation.consentState() == ConsentState.ALLOWED) - assertTrue(caroConversation.consentState() == ConsentState.ALLOWED) + assertTrue("Bob convo should be allowed", bobConversation.consentState() == ConsentState.ALLOWED) + assertTrue("Caro convo should be allowed", caroConversation.consentState() == ConsentState.ALLOWED) bobClient.contacts.deny(listOf(alice.walletAddress, fixtures.caro.walletAddress)) assertEquals(bobClient.contacts.consentList.entries.size, 2) - assertTrue(bobConversation.consentState() == ConsentState.DENIED) - assertTrue(caroConversation.consentState() == ConsentState.DENIED) + assertTrue("Bob convo should be denied", bobConversation.consentState() == ConsentState.DENIED) + assertTrue("Caro convo should be denied", caroConversation.consentState() == ConsentState.DENIED) } } @@ -880,13 +880,13 @@ class ConversationTest { val preferenceList = Topic.preferenceList(validId).description // check if validation of topics accepts all types - assertTrue(Topic.isValidTopic(privateStore)) - assertTrue(Topic.isValidTopic(contact)) - assertTrue(Topic.isValidTopic(userIntro)) - assertTrue(Topic.isValidTopic(userInvite)) - assertTrue(Topic.isValidTopic(directMessageV1)) - assertTrue(Topic.isValidTopic(directMessageV2)) - assertTrue(Topic.isValidTopic(preferenceList)) + assertTrue("Private Store should be valid topic", Topic.isValidTopic(privateStore)) + assertTrue("Contact should be valid topic", Topic.isValidTopic(contact)) + assertTrue("User Intro should be valid topic", Topic.isValidTopic(userIntro)) + assertTrue("userInvite should be valid topic", Topic.isValidTopic(userInvite)) + assertTrue("directMessageV1 should be valid topic", Topic.isValidTopic(directMessageV1)) + assertTrue("directMessageV2 should be valid topic", Topic.isValidTopic(directMessageV2)) + assertTrue("preferenceList should be valid topic", Topic.isValidTopic(preferenceList)) } @Test diff --git a/library/src/androidTest/java/org/xmtp/android/library/ConversationsTest.kt b/library/src/androidTest/java/org/xmtp/android/library/ConversationsTest.kt index 9aca41e32..004216774 100644 --- a/library/src/androidTest/java/org/xmtp/android/library/ConversationsTest.kt +++ b/library/src/androidTest/java/org/xmtp/android/library/ConversationsTest.kt @@ -207,10 +207,10 @@ class ConversationsTest { val alixConversation = alixConversations.find { it.topic == boConversation.topic } - assertNotNull(alixConversation) + assertNotNull("Alix Conversation should exist " + alixConversations.size, alixConversation) // Commenting out for now, the signature being created is not valid -// val isAllowed = runBlocking { alixClient.contacts.isAllowed(boClient.address) } -// assertTrue(isAllowed) + val isAllowed = runBlocking { alixClient.contacts.isAllowed(boClient.address) } + assertTrue(isAllowed) } @Test @@ -268,8 +268,8 @@ class ConversationsTest { } val alixConversations = runBlocking { alixClient.conversations.list() } val alixConversation = alixConversations.find { it.topic == boConversation.topic } - assertNotNull(alixConversation) + assertNotNull("Alix conversation should exist" + alixConversations.size, alixConversation) val isAllowed = runBlocking { alixClient.contacts.isAllowed(boClient.address) } - assertFalse(isAllowed) + assertFalse("Should not be allowed", isAllowed) } } diff --git a/library/src/main/java/org/xmtp/android/library/messages/Signature.kt b/library/src/main/java/org/xmtp/android/library/messages/Signature.kt index 25aa7eac2..6fe92e792 100644 --- a/library/src/main/java/org/xmtp/android/library/messages/Signature.kt +++ b/library/src/main/java/org/xmtp/android/library/messages/Signature.kt @@ -50,7 +50,7 @@ fun Signature.enableIdentityText(key: ByteArray): String = ("XMTP : Enable Identity\n" + "${key.toHex()}\n" + "\n" + "For more info: https://xmtp.org/signatures/") fun Signature.consentProofText(peerAddress: String, timestamp: Long): String { - val formatter = SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss 'GMT'") + val formatter = SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'") formatter.timeZone = TimeZone.getTimeZone("UTC") val timestampString = formatter.format(timestamp) return ("XMTP : Grant inbox consent to sender\n" + "\n" + "Current Time: ${timestampString}\n" + "From Address: ${peerAddress}\n" + "\n" + "For more info: https://xmtp.org/signatures/")