46 lines
1.9 KiB
JavaScript
46 lines
1.9 KiB
JavaScript
// Generated, do not edit. sha256:fab8822364846f02f8b385ca8840c17f7abfa1ebbb404d9f6b628a1d6b098476
|
|
import { describe, it } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
|
|
import { compoundsViaBalance, looksLikeDepositWithoutPrincipal } from '../../client/actions/interest-compounding.js';
|
|
|
|
const rij = (extra) => ({ rateKind: 'fixed', principalAssetId: 1, payoutAssetId: 1, principalAmount: null,
|
|
endsOn: '2029-08-20', ...extra });
|
|
const invoer = (extra) => ({ rateKind: 'fixed', principalAssetId: '1', payoutAssetId: '1', principalAmount: '',
|
|
endsOn: '2029-08-20', ...extra });
|
|
|
|
describe('compoundsViaBalance', () => {
|
|
it('ziet het in een rij en in de waarden van de bewerkrij', () => {
|
|
assert.equal(compoundsViaBalance(rij()), true);
|
|
assert.equal(compoundsViaBalance(invoer()), true);
|
|
});
|
|
|
|
it('niet met een vaste hoofdsom', () => {
|
|
assert.equal(compoundsViaBalance(rij({ principalAmount: 1072628 })), false);
|
|
assert.equal(compoundsViaBalance(invoer({ principalAmount: '10726,28' })), false);
|
|
});
|
|
|
|
it('niet als de rente in een ander asset uitkeert, want dan groeit de hoofdsom er niet door', () => {
|
|
assert.equal(compoundsViaBalance(rij({ payoutAssetId: 2 })), false);
|
|
});
|
|
|
|
it('niet bij handmatig of import, want daar rekent de app niets', () => {
|
|
assert.equal(compoundsViaBalance(rij({ rateKind: 'variable', principalAssetId: null })), false);
|
|
});
|
|
});
|
|
|
|
describe('looksLikeDepositWithoutPrincipal', () => {
|
|
it('waarschuwt met een einddatum', () => {
|
|
assert.equal(looksLikeDepositWithoutPrincipal(invoer()), true);
|
|
});
|
|
|
|
it('waarschuwt niet zonder einddatum, want dat is een spaarrekening', () => {
|
|
assert.equal(looksLikeDepositWithoutPrincipal(invoer({ endsOn: '' })), false);
|
|
assert.equal(looksLikeDepositWithoutPrincipal(rij({ endsOn: null })), false);
|
|
});
|
|
|
|
it('waarschuwt niet met een hoofdsom', () => {
|
|
assert.equal(looksLikeDepositWithoutPrincipal(invoer({ principalAmount: '10726,28' })), false);
|
|
});
|
|
});
|