mirror of
https://github.com/muun/recovery.git
synced 2025-11-12 06:50:18 -05:00
Update project structure and build process
This commit is contained in:
27
libwallet/newop/exchange_rates_test.go
Normal file
27
libwallet/newop/exchange_rates_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package newop
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/shopspring/decimal"
|
||||
)
|
||||
|
||||
func TestExchangeWindowConvert(t *testing.T) {
|
||||
|
||||
window := &ExchangeRateWindow{}
|
||||
window.AddRate("BTC", 1)
|
||||
window.AddRate("USD", 32_000)
|
||||
|
||||
amount := NewMonetaryAmountFromSatoshis(100_000_000)
|
||||
|
||||
converted := window.convert(amount, "USD")
|
||||
|
||||
if converted.Currency != "USD" {
|
||||
t.Fatalf("expected converted currency to be USD, got %v", converted.Currency)
|
||||
}
|
||||
|
||||
if converted.Value.Cmp(decimal.NewFromInt(32_000)) != 0 {
|
||||
t.Fatalf("expected converted amount to be 32000, got %v", converted.Value)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user