Merge branch 'clapback-fixes' of anthonycicc/slackbot into master

This commit is contained in:
Anthony Cicchetti 2019-10-03 23:42:47 -04:00 committed by Gitea
commit f42ff1f920
2 changed files with 8 additions and 4 deletions

View file

@ -15,9 +15,13 @@ fun String.toSpongemock(): String {
} }
fun String.toClapText(): String { fun String.toClapText(): String {
return this with(this
.split(' ') .split(' ')) {
.joinToString(separator = " 👏 ") if (this.size == 1) {
return "\uD83D\uDC4F ${this[0]} \uD83D\uDC4F"
}
return joinToString(separator = " 👏 ")
}
} }
private fun Int.isOdd(): Boolean = this.rem(2) == 0 private fun Int.isOdd(): Boolean = this.rem(2) == 0

View file

@ -74,7 +74,7 @@ internal class TransformationsTest {
@Test @Test
fun `Claptext works with one word`() { fun `Claptext works with one word`() {
val actual = "Find" val actual = "Find"
val expected = "Find" val expected = "\uD83D\uDC4F Find \uD83D\uDC4F"
assertEquals(expected, actual.toClapText()) assertEquals(expected, actual.toClapText())
} }