refactor!: support RUB only (WealthLedger/main#55) #203
@@ -44,6 +44,6 @@ describe('performance cash flows', () => {
|
||||
]);
|
||||
expect(result.flows).toHaveLength(1);
|
||||
expect(formatDecimal(sumFlows(result.flows))).toBe('100');
|
||||
expect([...result.missingAmountAccounts]).toEqual(['A']);
|
||||
expect([...result.missingAmountAccounts]).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -68,10 +68,8 @@ function appendCashFlow(
|
||||
missingAmountAccounts.add(operation.accountId);
|
||||
return;
|
||||
}
|
||||
if (value.currency !== 'RUB') {
|
||||
missingAmountAccounts.add(operation.accountId);
|
||||
return;
|
||||
}
|
||||
// RUB-only: non-RUB cash movements have no rate to RUB and are left out of XIRR.
|
||||
if (value.currency !== 'RUB') return;
|
||||
const amount = magnitude(value.value);
|
||||
flows.push({
|
||||
accountId: operation.accountId,
|
||||
|
||||
@@ -94,13 +94,6 @@ describe('investment performance read', () => {
|
||||
expect(result.data?.return).toMatchObject({ basis: 'period', value: '0.1' });
|
||||
});
|
||||
|
||||
it('reports incomplete history for a non-RUB deposit', async () => {
|
||||
const broken = account('A');
|
||||
broken.operations.push({ ...operation('A', 'OPERATION_TYPE_INPUT', '21'), payload: { type: 'OPERATION_TYPE_INPUT', payment: { currency: 'usd', units: '21', nano: 0 } } });
|
||||
expect((await setup([broken]).service.read('user', 'A')).meta.unavailable)
|
||||
.toEqual([{ accountId: 'A', name: 'A', reason: 'OPERATIONS_HISTORY_INCOMPLETE' }]);
|
||||
});
|
||||
|
||||
it('reports incomplete history for a deposit without an amount', async () => {
|
||||
const broken = account('A');
|
||||
broken.operations.push({ ...operation('A', 'OPERATION_TYPE_INPUT', '0'), payload: { type: 'OPERATION_TYPE_INPUT' } } as never);
|
||||
|
||||
Reference in New Issue
Block a user