diff --git a/app/src/test/java/jp/panta/misskeyandroidclient/model/users/UserTest.kt b/app/src/test/java/jp/panta/misskeyandroidclient/model/users/UserTest.kt index 066b3b9f98..f274984f21 100644 --- a/app/src/test/java/jp/panta/misskeyandroidclient/model/users/UserTest.kt +++ b/app/src/test/java/jp/panta/misskeyandroidclient/model/users/UserTest.kt @@ -69,4 +69,45 @@ class UserTest { ) assertEquals("https://example.com/@Panta@misskey.io", profileUrl) } + + @Test + fun displayUserName_GiveSameHost() { + val user = User.Simple( + id = User.Id(0, "id"), + avatarUrl = "", + emojis = emptyList(), + host = "misskey.io", + isBot = false, + isCat = false, + name = "Panta", + userName = "Panta", + nickname = null, + isSameHost = true, + instance = null, + avatarBlurhash = null, + badgeRoles = emptyList(), + ) + assertEquals("@Panta", user.displayUserName) + } + + @Test + fun displayUserName_GiveDifferentHost() { + val user = User.Simple( + id = User.Id(0, "id"), + avatarUrl = "", + emojis = emptyList(), + host = "misskey.io", + isBot = false, + isCat = false, + name = "Panta", + userName = "Panta", + nickname = null, + isSameHost = false, + instance = null, + avatarBlurhash = null, + badgeRoles = emptyList(), + ) + assertEquals("@Panta@misskey.io", user.displayUserName) + } + } \ No newline at end of file