Skip to content

Commit

Permalink
add a test for the codec
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Jun 14, 2024
1 parent fa948ca commit d7ebae2
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,37 @@ class GroupUpdatedTest {
caroClient = fixtures.caroClient
}

@Test
fun testCanUpdateGroupName() {
Client.register(codec = GroupUpdatedCodec())

val group = runBlocking {
alixClient.conversations.newGroup(
listOf(
bo.walletAddress,
caro.walletAddress
), groupName = "Start Name"
)
}
var messages = group.messages()
assertEquals(messages.size, 1)
runBlocking {
group.updateGroupName("Group Name")
messages = group.messages()
assertEquals(messages.size, 2)

val content: GroupUpdated? = messages.last().content()
assertEquals(
"Start Name",
content?.metadataFieldChangesList?.first()?.oldValue
)
assertEquals(
"Group Name",
content?.metadataFieldChangesList?.first()?.newValue
)
}
}

@Test
fun testCanAddMembers() {
Client.register(codec = GroupUpdatedCodec())
Expand Down

0 comments on commit d7ebae2

Please sign in to comment.