Skip to content

Commit

Permalink
feat: 単体テストを追加した
Browse files Browse the repository at this point in the history
  • Loading branch information
pantasystem committed Jan 7, 2024
1 parent 5f82760 commit 22f3add
Showing 1 changed file with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,45 @@ class UserTest {
)
assertEquals("https://example.com/@[email protected]", 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("@[email protected]", user.displayUserName)
}

}

0 comments on commit 22f3add

Please sign in to comment.