Render currencies etc.

This commit is contained in:
2020-07-09 17:07:05 +02:00
parent eaac245f4e
commit 4849a755dc
6 changed files with 51 additions and 11 deletions
@@ -13,14 +13,5 @@ module('Integration | Component | reimbursement-list', function(hooks) {
await render(hbs`<ReimbursementList />`);
assert.equal(this.element.textContent.trim(), '');
// Template block usage:
await render(hbs`
<ReimbursementList>
template block text
</ReimbursementList>
`);
assert.equal(this.element.textContent.trim(), 'template block text');
});
});
@@ -0,0 +1,18 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
module('Integration | Helper | fmt-fiat-currency', function(hooks) {
setupRenderingTest(hooks);
test('it returns the number formatted as currency', async function(assert) {
this.set('amount', 13.9);
await render(hbs`{{fmt-fiat-currency this.amount}}`);
assert.equal(this.element.textContent.trim(), '€13.90', 'using EUR amount by default');
await render(hbs`{{fmt-fiat-currency this.amount 'USD'}}`);
assert.equal(this.element.textContent.trim(), '$13.90', 'using the defined currency');
});
});
@@ -0,0 +1,16 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
module('Integration | Helper | sats-to-btc', function(hooks) {
setupRenderingTest(hooks);
test('it converts satoshis to full BTC amounts', async function(assert) {
this.set('amount', '166800');
await render(hbs`{{sats-to-btc this.amount}}`);
assert.equal(this.element.textContent.trim(), '0.001668');
});
});