Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
bmarty committed Oct 16, 2024
1 parent 0272788 commit 6392404
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class IdentityChangeStatePresenterTest {
}

@Test
fun `present - when the room emits identity change, but the feature is disabled, the presenter emits new state`() = runTest {
fun `present - when the room emits identity change, but the feature is disabled, the presenter does not emit new state`() = runTest {
val room = FakeMatrixRoom(
isEncrypted = true,
)
Expand Down Expand Up @@ -106,7 +106,7 @@ class IdentityChangeStatePresenterTest {
}

@Test
fun `present - when the clear room emits identity change, the presenter does not emits new state`() = runTest {
fun `present - when the clear room emits identity change, the presenter does not emit new state`() = runTest {
val room = FakeMatrixRoom(isEncrypted = false)
val presenter = createIdentityChangeStatePresenter(room)
presenter.test {
Expand All @@ -128,6 +128,7 @@ class IdentityChangeStatePresenterTest {
assertThat(finalItem.roomMemberIdentityStateChanges).hasSize(1)
val value = finalItem.roomMemberIdentityStateChanges.first()
assertThat(value.identityRoomMember.userId).isEqualTo(A_USER_ID_2)
assertThat(value.identityRoomMember.displayNameOrDefault).isEqualTo(A_USER_ID_2.extractedDisplayName)
assertThat(value.identityState).isEqualTo(IdentityState.PinViolation)
}
}
Expand Down Expand Up @@ -163,14 +164,14 @@ class IdentityChangeStatePresenterTest {
assertThat(finalItem.roomMemberIdentityStateChanges).hasSize(1)
val value = finalItem.roomMemberIdentityStateChanges.first()
assertThat(value.identityRoomMember.userId).isEqualTo(A_USER_ID_2)
assertThat(value.identityRoomMember.disambiguatedDisplayName).isEqualTo("Alice")
assertThat(value.identityRoomMember.displayNameOrDefault).isEqualTo("Alice")
assertThat(value.identityRoomMember.avatarData.size).isEqualTo(AvatarSize.ComposerAlert)
assertThat(value.identityState).isEqualTo(IdentityState.PinViolation)
}
}

@Test
fun `present - when the user pin the identity, the presenter invokes the encryption service api`() =
fun `present - when the user pins the identity, the presenter invokes the encryption service api`() =
runTest {
val lambda = lambdaRecorder<UserId, Result<Unit>> { Result.success(Unit) }
val encryptionService = FakeEncryptionService(
Expand Down

0 comments on commit 6392404

Please sign in to comment.