Skip to content

Commit

Permalink
Add test for metadata codec (#260)
Browse files Browse the repository at this point in the history
* add test for codecc

* fix linter
  • Loading branch information
nplasterer authored Jun 17, 2024
1 parent afc47b9 commit 0d9b911
Showing 1 changed file with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,36 @@ class GroupUpdatedTest {
assertEquals(messages.size, 1)
assert(messages.first().fallbackContent.isBlank())
}

@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.first().content()
assertEquals(
"Start Name",
content?.metadataFieldChangesList?.first()?.oldValue
)
assertEquals(
"Group Name",
content?.metadataFieldChangesList?.first()?.newValue
)
}
}
}

0 comments on commit 0d9b911

Please sign in to comment.