Cleaned up tests.
This commit is contained in:
parent
0a6b84fa2b
commit
8efb09cea8
3 changed files with 9 additions and 7 deletions
|
@ -51,7 +51,7 @@ class FeedReaderTest {
|
|||
fun readFeedTest() {
|
||||
var messages = readFeed("https://feeds.thauvin.net/ethauvin")
|
||||
assertThat(messages.size, "size = 10").isEqualTo(10)
|
||||
assertThat(messages[1].msg, "feed entry url").contains("ethauvin")
|
||||
assertThat(messages[1].msg, "feed entry url").contains("erik.thauvin.net")
|
||||
|
||||
messages = readFeed("https://lorem-rss.herokuapp.com/feed?length=0")
|
||||
assertThat(messages[0].msg, "nothing to view").contains("nothing")
|
||||
|
|
|
@ -31,8 +31,10 @@
|
|||
*/
|
||||
package net.thauvin.erik.mobibot
|
||||
|
||||
import assertk.all
|
||||
import assertk.assertThat
|
||||
import assertk.assertions.isEqualTo
|
||||
import assertk.assertions.length
|
||||
import net.thauvin.erik.mobibot.Utils.appendIfMissing
|
||||
import net.thauvin.erik.mobibot.Utils.bold
|
||||
import net.thauvin.erik.mobibot.Utils.buildCmdSyntax
|
||||
|
@ -187,8 +189,10 @@ class UtilsTest {
|
|||
|
||||
@Test
|
||||
fun testObfuscate() {
|
||||
assertThat(ascii.obfuscate().length, "obfuscate is right length").isEqualTo(ascii.length)
|
||||
assertThat(ascii.obfuscate(), "obfuscate()").isEqualTo("x".repeat(ascii.length))
|
||||
assertThat(ascii.obfuscate(), "obfuscate()").all {
|
||||
length().isEqualTo(ascii.length)
|
||||
isEqualTo(("x".repeat(ascii.length)))
|
||||
}
|
||||
assertThat(" ".obfuscate(), "obfuscate(blank)").isEqualTo(" ")
|
||||
}
|
||||
|
||||
|
|
|
@ -48,9 +48,7 @@ class CalcTest {
|
|||
fun testCalculate() {
|
||||
assertThat(calculate("1 + 1"), "calculate(1+1)").isEqualTo("1+1 = ${bold(2)}")
|
||||
assertThat(calculate("1 -3"), "calculate(1 -3)").isEqualTo("1-3 = ${bold(-2)}")
|
||||
assertThat(calculate("pi+π+e+φ"), "calculate(pi+π+e+φ)")
|
||||
.isEqualTo("pi+π+e+φ = ${bold("10.62")}")
|
||||
assertThat { calculate("one + one") }
|
||||
.isFailure().isInstanceOf(UnknownFunctionOrVariableException::class.java)
|
||||
assertThat(calculate("pi+π+e+φ"), "calculate(pi+π+e+φ)").isEqualTo("pi+π+e+φ = ${bold("10.62")}")
|
||||
assertThat { calculate("one + one") }.isFailure().isInstanceOf(UnknownFunctionOrVariableException::class.java)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue