Output convertion result as is
This commit is contained in:
parent
8e03eda655
commit
0aa2136fec
3 changed files with 8 additions and 4 deletions
|
@ -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.")
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue