Use historic BTC rate for expense items; allow BTC as currency
This commit is contained in:
@@ -18,5 +18,12 @@ module('Integration | Helper | fmt-fiat-currency', function(hooks) {
|
||||
await render(hbs`{{fmt-fiat-currency this.amount 'USD'}}`);
|
||||
assert.ok(this.element.textContent.trim().match(/USD/),
|
||||
'using defined currency when given');
|
||||
|
||||
await render(hbs`{{fmt-fiat-currency 0.00123 'BTC'}}`);
|
||||
assert.ok(this.element.textContent.trim().match(/0.00123/),
|
||||
'allows more decimals');
|
||||
assert.ok(this.element.textContent.trim().match(/BTC/),
|
||||
'using defined currency when given');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user