Fixed CryptoPrices tests.
This commit is contained in:
parent
faf40d3048
commit
273ac60c7d
3 changed files with 19 additions and 47 deletions
|
@ -31,10 +31,8 @@
|
|||
*/
|
||||
package net.thauvin.erik.mobibot.modules
|
||||
|
||||
import net.thauvin.erik.crypto.CryptoException
|
||||
import net.thauvin.erik.crypto.CryptoPrice.Companion.marketPrice
|
||||
import net.thauvin.erik.mobibot.modules.CryptoPrices.Companion.currentPrice
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.assertj.core.api.Assertions.assertThatThrownBy
|
||||
import org.testng.annotations.Test
|
||||
|
||||
/**
|
||||
|
@ -44,29 +42,14 @@ class CryptoPricesTest {
|
|||
@Test
|
||||
@Throws(ModuleException::class)
|
||||
fun testMarketPrice() {
|
||||
var price = marketPrice("BTC", "USD")
|
||||
var price = currentPrice(listOf("BTC"))
|
||||
assertThat(price.base).describedAs("is BTC").isEqualTo("BTC")
|
||||
assertThat(price.currency).describedAs("is USD").isEqualTo("USD")
|
||||
assertThat(price.amount).describedAs("BTC > 0").isGreaterThan(0.00)
|
||||
|
||||
price = marketPrice("ETH", "EUR")
|
||||
price = currentPrice(listOf("ETH", "EUR"))
|
||||
assertThat(price.base).describedAs("is ETH").isEqualTo("ETH")
|
||||
assertThat(price.currency).describedAs("is EUR").isEqualTo("EUR")
|
||||
assertThat(price.amount).describedAs("ETH > 0").isGreaterThan(0.00)
|
||||
|
||||
price = marketPrice("ETH2", "GBP")
|
||||
assertThat(price.base).describedAs("is ETH2").isEqualTo("ETH2")
|
||||
assertThat(price.currency).describedAs("is GBP").isEqualTo("GBP")
|
||||
assertThat(price.amount).describedAs("ETH2 > 0").isGreaterThan(0.00)
|
||||
|
||||
assertThatThrownBy { marketPrice("FOO", "USD") }
|
||||
.describedAs("FOO")
|
||||
.isInstanceOf(CryptoException::class.java)
|
||||
.hasMessageContaining("Invalid base currency")
|
||||
|
||||
assertThatThrownBy { marketPrice("FOO", "BAR") }
|
||||
.describedAs("FOO-BAR")
|
||||
.isInstanceOf(CryptoException::class.java)
|
||||
.hasMessageContaining("Invalid currency (BAR)")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue