Skip to content

Commit

Permalink
Add libravatar test
Browse files Browse the repository at this point in the history
  • Loading branch information
trwnh authored Oct 15, 2019
1 parent 7e3eed6 commit f1baabd
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions app/src/test/java/de/kuschku/quasseldroid/util/AvatarHelperTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,48 @@ class AvatarHelperTest {
)
}

@Test
fun testLibravatarAvatars() {
val message = MessageData.of(
messageId = MsgId(1),
time = Instant.now(),
type = Message_Type.of(Message_Type.Plain),
flag = Message_Flag.of(),
bufferId = BufferId(0),
networkId = NetworkId(0),
currentBufferId = BufferId(0),
currentBufferType = Buffer_Type.of(),
sender = "justJanne",
senderPrefixes = "",
realName = "Janne Mareike Koschinski <janne@kuschku.de>",
avatarUrl = "",
content = "Lorem Ipsum I Dolor Sit Amet",
ignored = false
)

assert(
AvatarHelper.avatar(
MessageSettings(
showLibravatarAvatars = true,
showIRCCloudAvatars = true
),
message
).contains(
Avatar.LibravatarAvatar("https://seccdn.libravatar.org/avatar/81128f11cae692bc486e3f88b854ddf1?d=404")
)
)

assert(
AvatarHelper.avatar(
MessageSettings(
showLib2568217a2207f06de59d0fcc1f14b8bc?s=160&d=404ravatarAvatars = false,
showIRCCloudAvatars = false
),
message
).isEmpty()
)
}

@Test
fun testIrcCloudAvatars() {
val message = MessageData.of(
Expand Down

0 comments on commit f1baabd

Please sign in to comment.