Use historic BTC rate for expense items; allow BTC as currency

This commit is contained in:
2024-12-18 12:34:31 +04:00
parent 89ddde28b8
commit 697ace35b5
8 changed files with 73 additions and 43 deletions
@@ -39,12 +39,4 @@ module('Unit | Component | add-reimbursement', function(hooks) {
assert.equal(component.totalEUR, '71');
assert.equal(component.totalUSD, '59');
});
test('#updateTotalAmountFromFiat', async function(assert) {
let component = createComponent('component:add-reimbursement');
component.expenses = expenses;
await component.exchangeRates.fetchRates();
component.updateTotalAmountFromFiat();
assert.equal(component.total, '0.01323322', 'converts EUR and USD totals to BTC and rounds to 8 decimals');
});
});
+2 -2
View File
@@ -7,7 +7,7 @@ module('Unit | Service | exchange-rates', function(hooks) {
test('#fetchRates', async function(assert) {
let service = this.owner.lookup('service:exchange-rates');
await service.fetchRates();
assert.equal(service.btceur, 9167.57, 'fetches BTCEUR from Bitstamp');
assert.equal(service.btcusd, 10749.70, 'fetches BTCUSD from Bitstamp');
assert.equal(service.EUR, 9167.57, 'fetches BTCEUR from Bitstamp');
assert.equal(service.USD, 10749.70, 'fetches BTCUSD from Bitstamp');
});
});