Output convertion result as is

This commit is contained in:
Erik C. Thauvin 2022-08-15 09:52:41 -07:00
parent 8e03eda655
commit 0aa2136fec
3 changed files with 8 additions and 4 deletions

View file

@ -147,7 +147,7 @@ class CurrencyConverter : ThreadedModule() {
if (json.getBoolean("success")) {
PublicMessage(
"${cmds[0]} ${SYMBOLS[to]} = ${json.getDouble("result")} ${SYMBOLS[from]}"
"${cmds[0]} ${SYMBOLS[to]} = ${json.get("result")} ${SYMBOLS[from]}"
)
} else {
ErrorMessage("Sorry, an error occurred while converting the currencies.")

View file

@ -62,6 +62,10 @@ class CurrencyConverterTest {
convertCurrency("100 USD to EUR").msg,
"100 USD to EUR"
).matches("100 United States Dollar = \\d{2,3}\\.\\d+ Euro".toRegex())
assertThat(
convertCurrency("1 USD to BTC").msg,
"1 USD to BTC"
).matches("1 United States Dollar = 0\\.\\d+ Bitcoin".toRegex())
assertThat(
convertCurrency("100,000.00 GBP to BTC").msg,
"100 USD to EUR"