Skip to content

Commit

Permalink
fix up the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Jan 6, 2025
1 parent 1c9e96e commit 06e352d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,16 @@ class ConversationsTest {
runBlocking { boClient.conversations.newGroup(listOf(caro.walletAddress)) }
val group2 =
runBlocking { boClient.conversations.newGroup(listOf(caro.walletAddress)) }
runBlocking { dm.send("Howdy") }
runBlocking { group2.send("Howdy") }
val dmMessage = runBlocking { dm.send("Howdy") }
val groupMessage = runBlocking { group2.send("Howdy") }
runBlocking { boClient.conversations.syncAllConversations() }
val conversations = runBlocking { boClient.conversations.list() }
val conversationsOrdered =
runBlocking { boClient.conversations.list(order = Conversations.ConversationOrder.LAST_MESSAGE) }
assertEquals(conversations.size, 3)
assertEquals(conversationsOrdered.size, 3)
assertEquals(conversations.map { it.id }, listOf(dm.id, group1.id, group2.id))
assertEquals(conversationsOrdered.map { it.id }, listOf(group2.id, dm.id, group1.id))
assertEquals(conversations.map { it.id }, listOf(group2.id, dm.id, group1.id))
runBlocking {
assertEquals(group2.lastMessage()!!.id, groupMessage)
assertEquals(dm.lastMessage()!!.id, dmMessage)
}
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,8 @@ class DmTest {
runBlocking { group.send("Howdy") }
runBlocking { boClient.conversations.syncAllConversations() }
val conversations = runBlocking { boClient.conversations.listDms() }
val conversationsOrdered =
runBlocking { boClient.conversations.listDms(order = Conversations.ConversationOrder.LAST_MESSAGE) }
assertEquals(conversations.size, 2)
assertEquals(conversationsOrdered.size, 2)
assertEquals(conversations.map { it.id }, listOf(dm1.id, dm2.id))
assertEquals(conversationsOrdered.map { it.id }, listOf(dm2.id, dm1.id))
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,12 +513,8 @@ class GroupTest {
runBlocking { group2.send("Howdy") }
runBlocking { boClient.conversations.syncAllConversations() }
val conversations = runBlocking { boClient.conversations.listGroups() }
val conversationsOrdered =
runBlocking { boClient.conversations.listGroups(order = Conversations.ConversationOrder.LAST_MESSAGE) }
assertEquals(conversations.size, 2)
assertEquals(conversationsOrdered.size, 2)
assertEquals(conversations.map { it.id }, listOf(group1.id, group2.id))
assertEquals(conversationsOrdered.map { it.id }, listOf(group2.id, group1.id))
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ import uniffi.xmtpv3.FfiConversationListItem
import uniffi.xmtpv3.FfiConversationType
import uniffi.xmtpv3.FfiConversations
import uniffi.xmtpv3.FfiCreateGroupOptions
import uniffi.xmtpv3.FfiDirection
import uniffi.xmtpv3.FfiGroupPermissionsOptions
import uniffi.xmtpv3.FfiListConversationsOptions
import uniffi.xmtpv3.FfiListMessagesOptions
import uniffi.xmtpv3.FfiMessage
import uniffi.xmtpv3.FfiMessageCallback
import uniffi.xmtpv3.FfiPermissionPolicySet
Expand All @@ -32,11 +30,6 @@ data class Conversations(
private val ffiConversations: FfiConversations,
) {

enum class ConversationOrder {
CREATED_AT,
LAST_MESSAGE;
}

enum class ConversationType {
ALL,
GROUPS,
Expand Down Expand Up @@ -161,7 +154,6 @@ data class Conversations(
after: Date? = null,
before: Date? = null,
limit: Int? = null,
order: ConversationOrder = ConversationOrder.CREATED_AT,
consentState: ConsentState? = null,
): List<Group> {
val ffiGroups = ffiConversations.listGroups(
Expand All @@ -183,7 +175,6 @@ data class Conversations(
after: Date? = null,
before: Date? = null,
limit: Int? = null,
order: ConversationOrder = ConversationOrder.CREATED_AT,
consentState: ConsentState? = null,
): List<Dm> {
val ffiDms = ffiConversations.listDms(
Expand Down

0 comments on commit 06e352d

Please sign in to comment.