Skip to content

Commit

Permalink
feat: テストケースを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
pantasystem committed Dec 24, 2023
1 parent 2460597 commit 1beff8f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,15 @@ data class Reaction(val reaction: String) {
&& reaction.startsWith(":")
&& reaction.endsWith(":")
}

fun isLegacyFormat(): Boolean {
return LegacyReaction.reactionMap.containsKey(reaction)
}

fun getLegacyEmoji(): String? {
if (isLegacyFormat()) {
return LegacyReaction.reactionMap[reaction]
}
return null
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,13 @@ class ReactionTest {
val reaction = Reaction("name@.")
Assertions.assertEquals("name", reaction.getNameAndHost())
}

@Test
fun isCustomEmojiFormat_GiveLegacyEmoji() {
LegacyReaction.defaultReaction.forEach {
Assertions.assertFalse(Reaction(it).isCustomEmojiFormat())
Assertions.assertTrue(Reaction(it).isLegacyFormat())
Assertions.assertEquals(LegacyReaction.reactionMap[it], Reaction(it).getLegacyEmoji())
}
}
}

0 comments on commit 1beff8f

Please sign in to comment.