-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolves Add annual adjustments for amountPerAnnum #30 #31
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution @mancubus77 I just made a small suggestion and can you please run prettier and update the unit tests and maybe add an additional test case. Thanks!
rate: 7.8, | ||
years: 25, | ||
paymentsPerAnnum: 1, | ||
amountPerAnnum: 12_000, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice thanks for the update! Last request from me and I will get it merged in 😃
With the test we want to test the expected output of amountPerAnnum
is correct, so ideally we would want to test it changes to the correct amount after the first year. You can use currentPositionInYears
to get the balance for a specific year.
You can do something like this:
const firstYearOptions = { ...initialOptions, currentPositionInYears: 1 };
const secondYearOptions = { ...initialOptions, currentPositionInYears: 2 };
const firstYearResult = compoundInterestPerPeriod(firstYearOptions);
const secondYearResult = compoundInterestPerPeriod(secondYearOptions);
Side note: I think I just spotted a previous bug with accrualOfPaymentsPerAnnum: false
where the end balance is not updating correctly. I am going to raise an issue and a pr for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually I just realised we don't actually return amountPerAnnum
to check the output, should we return this amount so we can see what the final contributions would be further down the line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am going to approve this and we can add this as an additional feature
Resolves #30