Add total sums of EUR/USD expenses
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
import { getContext } from '@ember/test-helpers';
|
||||
|
||||
export default function createComponent(lookupPath, named = {}) {
|
||||
let { owner } = getContext();
|
||||
let componentManager = owner.lookup('component-manager:glimmer');
|
||||
let { class: componentClass } = owner.factoryFor(lookupPath);
|
||||
return componentManager.createComponent(componentClass, { named });
|
||||
}
|
||||
@@ -6,10 +6,8 @@ import { hbs } from 'ember-cli-htmlbars';
|
||||
module('Integration | Component | add-reimbursement', function(hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
// test('it renders', async function(assert) {
|
||||
// Set any properties with this.set('myProperty', 'value');
|
||||
// Handle any actions with this.set('myAction', function(val) { ... });
|
||||
// await render(hbs`<AddReimbursement />`);
|
||||
// assert.equal(this.element.textContent.trim(), '');
|
||||
// });
|
||||
test('it works', async function(assert) {
|
||||
await render(hbs`<AddReimbursement />`);
|
||||
assert.ok(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import createComponent from 'kredits-web/tests/helpers/create-component';
|
||||
|
||||
const expenses = [
|
||||
{
|
||||
title: "Server rent",
|
||||
description: "Dedicated server: andromeda.kosmos.org, April 2020",
|
||||
currency: "EUR",
|
||||
amount: 39.00,
|
||||
date: "2020-05-06",
|
||||
url: "https://wiki.kosmos.org/Infrastructure#Hetzner",
|
||||
tags: ["infrastructure", "server", "hetzner"]
|
||||
},
|
||||
{
|
||||
title: "Server rent",
|
||||
description: "Dedicated server: centaurus.kosmos.org, April 2020",
|
||||
currency: "EUR",
|
||||
amount: 32.00,
|
||||
date: "2020-05-06",
|
||||
url: "https://wiki.kosmos.org/Infrastructure#Hetzner",
|
||||
tags: ["infrastructure", "server", "hetzner"]
|
||||
},
|
||||
{
|
||||
title: "Domain name kosmos.org",
|
||||
currency: "USD",
|
||||
amount: 59.00,
|
||||
date: "2020-05-07",
|
||||
tags: ["domain"]
|
||||
}
|
||||
];
|
||||
|
||||
module('Unit | Component | add-reimbursement', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('total sums of expenses in EUR and USD', function(assert) {
|
||||
let component = createComponent('component:add-reimbursement');
|
||||
component.expenses = expenses;
|
||||
assert.equal(component.totalEUR, '71');
|
||||
assert.equal(component.totalUSD, '59');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user